Set value Version 8 (Java)

Action group: JSON 


Description

The action adds a key-value pair to the JSON if such key does not already exist, and updates the value if the key does

Action icon


Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
JSONThe JSON to which the object will be addedRobin.JSON
Yes
JSONPathJSONPath describes the path to the JSON element. It always starts with a „/“ character. The corresponding keys are listed below. Indexes are used to access array elements (counting starts from 0). For example, the path „/key/1“ indicates that we are trying to access the second element of the array, which is accessible by the key „key“.Robin.String
Yes
ValueThe object to be added to the JSON as a value. Valid object types: collection, map, string, number, boolean. An error will occur if other types are used. Note: any value can be passed as a string.Robin.Object
No
Results
Processed JSONJSON containing new value.Robin.JSON

Special conditions of use

None.

Example of use

Task

Create a JSON and set its value: "firstName": "Joe"

Solution

Use the "Create a JSON", "Set value" actions.

Implementation

  1. Assemble a robot scheme with the actions.
  2. Set the "Set value" action parameters.
  3. Click "Start" in the top panel.

Result

The program robot completed successfully. JSON is created and the required value is set in it.

  • Нет меток