This function is used to set an item in an Object referenced by the directed path. The directed path field must refer to a container which is an object or an object item in a container. You must select a data type to identify how the data field is formatted.
All text fields in the statement can contain any of the escape sequences defined in Escape Sequences.
The action test state will be set to true if there are no errors. The action test state will be false if any errors occurred. Named variable Container Error will contain the errror text. If the Stop action on error option is enabled, the action will be terminated with an error message in the case of an error.
The available data types are:
- JSON Text
- The JSON text is specified as being contained in a named variable or is directly entered in a resizable multi line edit panel. Note that only Array and Object items can be specified.
- When using a named variable, the named variable field can contain any of the escape sequences defined in Escape Sequences. It is assumed that the named variable's content is properly formatted and escaped JSON text. This may be downloaded JSON returned by the Open URL statement.
- When specifying JSON text directly you must select the Edit JSON button to edit the text in a resizable multi line edit panel. More information on this panel can be found here.
- Referenced Item
- The item path field contains a directed path to the item to be added. The added item is copied. Therefore any item can be added ... even the entire destination container.
- Empty Array
- This is equivalent to adding JSON Text with the json field set to []
- Empty Object
- This is equivalent to adding JSON Text with the json field set to {}
- Null
- A Null item is added.
- Number
- A Number item is added represented by the number in the number field. If the number field is empty, the item will be set to 0. Otherwise the data must resolve to be a number or the action test state will be set to false.
- String
- A String item is added represented by the possibly empty text in the string field.
- Boolean
- A Boolean item is added. If the boolean field is empty, the item will be set to false. The boolean field may contain true or false (case insensitive). Optionally an integer may be used to specify the value. 0 represents false and any other integer value represents true.
If an item being set already exists, it is overwritten.
Example:
{
"location" : {
"place" : "unknown"
}
}Assume the above JSON is represented in a container named sample. The following statements...
Set the container object item at 'sample.location.place' to string 'Toronto'
Set the container object item at 'sample.location.province' to string 'Ontario'
will result in the following:
{
"location" : {
"place" : "Toronto",
"province" : "Ontario"
}
}
Containers
Directed Paths