Overview
This node allows users to add or update fields within JSON data. It supports two main operations: adding or updating a single field at a specified JSON path, and adding a new field to each item within an array located at a specified JSON path. This is useful for transforming JSON data by enriching it with additional information or modifying existing fields. For example, you can add a status field to each item in an array of orders or update a nested property in a JSON object.
Use Case Examples
- Add a 'status' field with value 'processed' to each item in an array of orders located at 'orders.items'.
- Update the 'limit' field inside 'Body.QueryLimitResponse.QueryLimitResult.Value.LimitInformation' with a new number value.
Properties
| Name | Meaning |
|---|---|
| Input JSON (Expression) | The JSON data input to be processed, typically provided as an expression returning JSON. |
| JSON Path | The dot-separated JSON path where the field will be added or updated. Must point to an existing array for the 'Add Field to Array Items' operation. |
| Field Name | The name of the field to add to each item in the array (used only in 'Add Field to Array Items' operation). |
| Field Value Type | The data type of the field value to be added (string, number, boolean, object, or array). |
| Field Value | The value to assign to the new field for each array item, interpreted according to the selected Field Value Type. |
Output
JSON
json- The transformed JSON data with the added or updated fields.
Troubleshooting
- Ensure the JSON Path is correctly specified and points to an existing array when using 'Add Field to Array Items'.
- Input JSON must be valid JSON or a valid expression returning JSON; otherwise, parsing errors will occur.
- Field Value must be compatible with the selected Field Value Type; invalid conversions will throw errors.
- If the JSON Path does not exist and 'Create Path if Not Exists' is disabled (for 'Add/Update Field' operation), the node will throw an error.