This project contains language-agnostic test files for the JSONata querying/transformation language.
In general, one directory in data
corresponds to one test case or one block of related test directories. Directories are grouped according to functional area. A typical test case contains three files:
expression.jsonata
, containing a JSONata expression to be compiled.input.json
, containing the input to the compiled expression.output.json
, containing the expected output.
input.json
andoutput.json
may instead contain the string "undefined", indicating thatundefined
should be used as input/expected as output respectively.bindings.json
may also be present. This object contains variable names and values to be bound into the JSONata expression before evaluation.- If
output.json
is missing, JSONata should throw an exception at evaluation time. - If
input.json
is also missing, JSONata should throw an exception at expression compilation time.
expression.jsonata
:
Account.Order[0].OrderID
input.json
:
{
"Account": {
"Account Name": "My Account",
"Order": [
{
"OrderID": "order103"
},
{
"OrderID": "order104"
}
]
}
}
output.json
:
"order103"