JSON Query logo

JSON Query

A small, flexible, and expandable JSON query language.

Documentation: https://github.com/jsonquerylang/jsonquery

Function name(argument1, argument2, ...)

A function is defined as a function name followed by comma separated arguments wrapped in round brackets. it is important to understand functions like filter, sort, and max are executed as a method in a chain: the operation is applied to the data input, and forwarded to the next method in the chain (if any).

Examples:

sort(.address.city, "asc")
filter(.age >= 21) | sort(.age, "asc")

Documentation: Functions

Function reference:

Operator (left operator right)

JSON Query supports all basic operators. When composing multiple operators, it is necessary to use parentheses. Operators do not have precedence since parentheses are required.

Examples:

filter(.age >= 18)
filter((.age >= 18) and (.age <= 65))

Documentation: Operators

Operator reference:

Pipe query2 | query2 | ...

A pipe is an array containing a series of queries. The queries in the pipeline are executed one by one, and the output of the first is the input for the next.

Example:

filter(.age >= 18) | sort(.name)

Documentation: Pipes

Object {prop1: query1, prop2: query2, ...}

An object is defined as a regular JSON object with a property name as key, and a query as value. Objects can be used to transform data or to execute multiple query pipelines in parallel.

Example:

{
  names: map(.name),
  numberOfNames: size()
}

Documentation: Objects

Array [query1, query2, ...]

An array is defined as a regular JSON array: enclosed in square brackets, with items separated by a comma.

Example:

filter(.city in ["New York", "Atlanta"])

Documentation: Arrays

Property .prop1.prop2

A property retrieves a property from an object. Multiple consecutive properties will retrieve a nested property.

Examples:

.age
.address.city
."first name"

Documentation: Properties

Value "string", number, boolean, null

JSON Query supports the following primitive values, the same as in JSON: "string", number, boolean, null.

Examples:

"Hello world"
"Multi line text\nwith \"quoted\" contents"
42
2.74
-1.2e3
true
false
null

Documentation: Values

Debugger

Error message...
Stack: 2/4