JSON Query

Query and transform your JSON data using powerful query languages.

Query Engines

Pandia supports three query engines, each with their own syntax and strengths:

JSON Query

JSON Query Language

A modern, intuitive query language designed specifically for JSON. Uses pipe-based chaining for readable queries.

.users | filter(.age > 25) | sort(.name)
JMESPath

JMESPath

A query language for JSON used by AWS CLI and other tools. Great for complex filtering and projections.

users[?age > `25`] | sort_by(@, &name)
Lodash

Lodash Expressions

Use familiar JavaScript/Lodash syntax for querying. Access the full power of Lodash utilities.

_.filter(data.users, o => o.age > 25)

JSON Query Language Syntax

Operation Syntax Description
Property access .users Get the users property
Array index .users[0] Get first element
Filter filter(.active == true) Filter by condition
Sort sort(.age) Sort by property
Pick fields pick(.name, .age) Select specific fields
Chain ... | ... | ... Chain operations with pipe

JMESPath Syntax

Operation Syntax Description
Property access users Get the users array
Wildcard users[*].name Get all names
Filter users[?active == `true`] Filter by condition
Sort sort_by(users, &age) Sort by property
Length length(users) Get array length
Pipe users | [0] Chain with pipe

Lodash Expressions

Available helper functions that operate on your data:

get(path) filter(pred) map(fn) find(pred) groupBy(key) sortBy(key) orderBy(key) uniq() pick(keys) omit(keys) sum() mean() max() min() first() last() take(n) flatten()

Access your data using data or use the shortcut functions directly.

Examples

Filter active users over 25

JSON Query: .users | filter(.active == true) | filter(.age > 25)
JMESPath: users[?active == `true` && age > `25`]
Lodash: _.filter(data.users, u => u.active && u.age > 25)

Get unique cities sorted alphabetically

Lodash: _.sortBy(_.uniq(_.map(data.users, 'city')))

Calculate average age

Lodash: _.meanBy(data.users, 'age')