Query Composition

In JSONata, everything is an expression. An expression comprises values, functions and operators which, when evaluated, produces a resulting value. Functions and operators are applied to values which themselves can be the results of evaluating sub-expressions. In that way, the language is fully composable to any level of complexity.

Parenthesized expressions and blocks

Used to override the operator precedence rules. E.g.

  • (5 + 3) * 4

Used to compute complex expressions on a context value

  • Product.(Price * Quantity) - both Price and Quantity are properties of the Product object

Used to support ‘code blocks’ - multiple expressions, separated by semicolons

  • (expr1; expr2; expr3)

Each expression in the block is evaluated in sequential order; the result of the last expression is returned from the block.