Skip to main content

Add a new field to a JSON

Add a new field to a JSON. This Wrk Action will allow you to take an existing JSON object and add a new field to it. By default this field will be added as a string to the top level of the object.

To specify a different location to add the field you can use jsonpath to specify the object you would like to add it to instead.

To add a value as a integer, boolean, object, or array you can select "Add field value without quotes?".

Application

  • Text

Inputs (what you have)

NameDescriptionData TypeRequired?Example
Original JSONThe JSON you would like to add a field toText (Long)Yes{“field1”:”value1”}
New field nameThe name of the new field you would like to addText (Short)Yesfield2
New field valueThe value of the new field you would like to addText (Long)Yesvalue2
JSONPath location to add new fieldThe JSONpath to the object where you would like to have the new field added.Text(short)No
Add field value without quotes?Select true if you would like to add the new field value without quotation marks. This is ideal for adding numbers, booleans, lists, objects, or strings that already contain quotesTrue or FalseNo
Overwrite existing field?Select true if you would like the Wrk Action to replace a existing field name with the new field value. If false will leave the original value in the fieldTrue or FalseNo

Note: the value of inputs can either be a set value in the configuration of the Wrk Action within the Wrkflow, or a variable from the Data library section. These variables in the Data library section are the outputs of previous Wrk Actions in the Wrkflow.

Outputs (what you get)

NameDescriptionData TypeRequired?Example
Updated JSONText (Long)Yes{“field1”:”value1”, “field2”:”value2”}

Outcomes

NameDescription
SuccessThis status is selected if details are extracted from the JSON.
Impossible to CompleteThis status is selected in the event of the following scenarios:Updated JSON is not in JSON format

Requirements

  • N/A