Table of Contents
MODIFY JSON
Category: Transform / Web
Description
This action modifies aspects of a JSON object. Commands this action can run are:
- Change property value
- Add property
- Delete property
- Rename property
- Reformat JSON
Action settings
Setting | Description |
---|---|
Column | Select the column that contains the JSON to be modified. |
Command | Select the modification to run on the selected JSON. Options: Change property value, Add property, Delete property, Rename property, or Format JSON. See below for the details of each command. |
If the node doesn't exist | Chose how EasyMorph will handle cases when the selected node doesn't exist in the dataset. Options: Fail (the workflow halts execution with a warning) or Ignore (the workflow continues). |
Change property value settings
Description: Changes the value of the select JSON path (key).
Setting | Description |
---|---|
JSON Path | Select the path/key to change the value of. |
Replace with* | Enter the value to be inserted. |
The inserted values are dates | Check this option on if the values are dates. |
* Setting can be specified using a parameter.
Add property options
Description: Adds a new property under the selected Parent node.
Option | Description |
---|---|
Parent | Select the node to insert the new property under. |
Node name* | Enter the name of the new property. |
Node value* | Enter the value of the new property. |
The inserted values are dates | Check this option on if the values are dates. |
* Setting can be specified using a parameter.
Delete property options
Description: Removes a property from the JSON in the selected column.
Option | Description |
---|---|
JSON Path | Select the node to remove the property from. |
Rename property options
Description: Renames a property in the selected JSON path.
Option | Description |
---|---|
JSON Path | Select the path to be renamed. |
New name | Enter the new name of the selected path. |
Format JSON options
Description: Converts the format of the JSON text from a single-cell string to a tree structure, or the reverse.
Option | Description |
---|---|
Make readable | This option converts the JSON from a single-cell text value to a more readable nested structure. |
Minimize size | This option converts the JSON from a nested structure to a single-cell text value. |
Remarks
Wildcards like "$" (for root node), and "[*]" (for an array) can be used where JSON Paths and nodes need to be selected/entered.
Examples
Change property value
Source JSON:
{ "name":"Doug", "id":7, "dept":"Accounting" }
Action parameters:
JSON Path is "name"
Replace with "(insert name)"
Result:
{ "name":"(insert name)", "id":7, "dept":"Accounting" }
Add property
Source JSON:
{ "name":"Doug", "id":7, "dept":"Accounting" }
Action parameters:
Parent is "$" (root node)
Node name is "age"
Node value is 50
Result:
{ "name":"(insert name)", "id":7, "dept":"Accounting", "age":50 }
Delete property
Source JSON:
{ "name":"Doug", "id":7, "dept":"Accounting" }
Action parameters:
JSON Path is "id"
Result:
{ "name":"(insert name)", "dept":"Accounting" }
Rename property
Source JSON:
{ "name":"Doug", "id":7, "dept":"Accounting" }
Action parameters:
JSON Path is "id"
Replace with "ident"
Result:
{ "name":"(insert name)", "ident":7, "dept":"Accounting" }
Format JSON (Minimize size)
Source JSON:
{ "name":"Doug", "id":7, "dept":"Accounting" }
Action parameters:
"Minimize size"
Result:
{"name":"(insert name)","ident":7,"dept":"Accounting"}
Format JSON (Make readable)
Source JSON:
{"name":"(insert name)","ident" 7,"dept":"Accounting"}
Action parameters:
"Make readable"
Result:
{ "name":"Doug", "id":7, "dept":"Accounting" }