Overview
This node allows users to add or update fields within a JSON object or add fields to each item in a JSON array. It is useful for transforming JSON data by inserting new key-value pairs or modifying existing ones at specified JSON paths. For example, it can be used to enrich API response data by adding additional metadata fields or updating existing values based on dynamic inputs.
Use Case Examples
- Adding a new field 'status' with value 'active' to a nested JSON object at path 'user.details'
- Updating the 'limit' field in a JSON response at path 'Body.QueryLimitResponse.QueryLimitResult.Value.LimitInformation'
- Adding a field 'processed' with boolean value true to each item in an array located at a specified JSON path
Properties
| Name | Meaning |
|---|---|
| Input JSON (Expression) | The JSON data input to be modified, typically provided as an expression returning a JSON object. |
| JSON Path | The dot-separated path within the JSON where the field will be added or updated. Must be a valid existing path or created if enabled. |
| Field Name | Optional. The name of the field to add or update. If provided, it is appended to the JSON Path to form the full path for the field. |
| Value Type | The data type of the value to be added or updated. Supported types are Array, Boolean, Number, Object, and String. |
| Value | The value to add or update at the specified JSON path, interpreted according to the selected Value Type. |
| Create Path if Not Exists | If enabled, the node will create the JSON path if it does not already exist. Otherwise, it only updates existing paths. |
Output
JSON
json- The modified JSON object after adding or updating the specified field(s).
Dependencies
- Requires no external API but uses internal JSON parsing and validation.
Troubleshooting
- Common errors include invalid JSON input, invalid or empty JSON path, and value type mismatches (e.g., providing a non-boolean string when boolean is expected).
- Errors like 'Path not found' occur if the JSON path does not exist and 'Create Path if Not Exists' is disabled.
- Value parsing errors occur if the value cannot be converted to the specified type, e.g., invalid JSON for object or array types.