Skip to content

Raw JSONata & saved queries

The jsonata: escape hatch

For anything the AST doesn't cover — date arithmetic, the wider function library — drop into raw JSONata:

yaml
jsonata: '$sort(entities, function($a,$b){ $a.score < $b.score }).name'

This runs the string verbatim. jsonata is mutually exclusive with the structured fields; mixing them is a schema error. Use it as a release valve, not the default — the YAML form gets you autocomplete in the dashboard, schema validation up front, and a shape an agent can emit without inventing a parse tree.

You can also pass raw JSONata directly to the CLI with --jsonata instead of the jsonata: field. Either way it's the same engine the structured form compiles down to.

Saved queries

Saved queries (stepbook q --save <name>) persist whichever form you wrote. The CLI tracks both the source text and its language (yaml or jsonata), so recalling a YAML query with --saved <name> compiles it the same way it ran originally.

Released under the MIT License.