Overview
This node allows you to apply a JSONata query to your input data within an n8n workflow. JSONata is a powerful query and transformation language for working with JSON data. The node can process either the entire input dataset at once or each item individually, depending on your configuration. This is useful for extracting, transforming, or restructuring data as it flows through your automation.
Common scenarios:
- Extracting specific fields from complex JSON objects.
- Transforming or aggregating data before passing it to another service.
- Restructuring API responses for downstream nodes.
Practical examples:
- Summing values in an array of objects and storing the result under a custom key.
- Filtering out unwanted properties from incoming webhook data.
- Mapping nested data into a flat structure for easier processing.
Properties
| Name | Type | Meaning |
|---|---|---|
| Query | String | The JSONata expression to evaluate against your input data. |
| Destination Key | String | The name of the JSON key where the result will be stored. Supports dot-notation for deep/nested keys (e.g., level1.level2.newKey). |
| Complete | Boolean | If true, the JSONata query is applied to the entire input array; if false, the query is applied to each item individually. |
Output
If Complete is set to
true:- The output is a single item with a
jsonobject containing the result of the JSONata query, placed under the specified destination key. - Example:
(If you set Destination Key to{ "data": <result_of_jsonata_query> }data.)
- The output is a single item with a
If Complete is set to
false:- Each input item produces a corresponding output item.
- For each item, the result of the JSONata query is stored under the specified destination key within the item's
jsonproperty. - Any binary data present in the input is preserved in the output.
Dependencies
External Libraries:
No external services or API keys are required.
Troubleshooting
Common issues:
- Invalid JSONata Expression: If your query is malformed, the node may throw an error indicating a syntax problem. Double-check your JSONata syntax using the JSONata Exerciser.
- Destination Key Issues: If you use an invalid or empty destination key, the node may not store the result as expected. Ensure the key is a valid string and follows dot-notation rules for nested keys.
- Data Structure Mismatch: If the input data does not match what your JSONata query expects (e.g., missing fields), the result may be
nullor empty.
Error messages:
- "Unable to evaluate JSONata expression" – Check your query for typos or logic errors.
- "Cannot set property of undefined" – Review your destination key and ensure all parent keys exist or are creatable.
