JSON Operations
Write JSON Value Node
Write a value to a JSON object
This node allows you to add or update a specific value in a JSON string.
Node Inputs
If “Create JSON” is selected:
- Key: The key of json. Note: Enclose in "" if your key contains special characters.
- Type:
Text
- Type:
- Value: The value to be added to the JSON object.
- Type:
Text
- Type:
If “Update JSON” is selected:
- JSON string: The JSON string you want to update
- Type:
Text
- Type:
- Key: The key of json. Note: Enclose in "" if your key contains special characters.
- Type:
Text
- Type:
- Value: The value to be added to the JSON object.
- Type:
Text
- Type:
Node Parameters
Create JSON vs Update JSON toggle:
- Create JSON: This will create a new JSON string with the key value pairs provided.
- Update JSON: This will update the given JSON string with the key value pairs provided.
Node Outputs
- Updated JSON: The updated JSON string
- Type:
Text
- Example usage:
{{write_json_value_0.updated_json}}
- Type:
Example
The below example shows a pipeline that takes in a JSON string and updates the value of the key “age” to “20”.
- Text Node: Contains the JSON string
{"name": "John Smith", "age": "25"}
- Write JSON Value Node: Updates the value of the key “age” to “20”
- JSON string:
{{text_0.text}}
- Key:
age
- Value:
20
- JSON string:
- Output: display the updated JSON
- Output:
{{write_json_value_0.updated_json}}
- Output: