Composition

Composition

Article Type: How-To Audience: Developers, App Admins Module: How To

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

    • Related Articles

    • Boolean Operators

      Article Type: How-To Audience: Developers, App Admins Module: How To Standard JSONata Boolean operators available in expressions throughout the Fuuz platform. and (Boolean AND) The and operator returns Boolean true if both operands evaluate to true. ...
    • Expressions

      Manipulating data with functions and expressions Fuuz Context Where this applies in Fuuz: JSONata-style expressions are used in Fuuz Data Pipelines, Mappings, and Rule Engines to transform payloads between MES/ERP endpoints, GraphQL resolvers, and ...
    • Constructs

      Programming constructs So far, we have introduced all the parts of the language that allow us to extract data from an input JSON document, combine the data using string and numeric operators, and format the structure of the output JSON document. What ...
    • Simple Queries

      Simple Queries Fuuz Context Where this applies in Fuuz: Simple queries underpin Fuuz Mapping definitions. Understanding object/array navigation, indexes, and sequence flattening helps avoid surprises when projecting inbound payloads to outbound ...