How-To Guides · Expressions and scripting

Composition

Last updated

How JSONata expressions compose — relevant anywhere you write expressions in Fuuz: screen transforms, validation expressions, data flow transforms, and saved scripts.

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.

See Also

Need more help?

Ask the Fuuz community, or open a ticket with Fuuz support.