Skip to main content

Append items to a JSON array

Wrk Product avatar
Written by Wrk Product
Updated this week

Append items to a JSON array. This Wrk Action can be provided with a JSON array or with a JSON object that contains an array.

Application

  • Text

Inputs (what you have)

Name

Description

Data Type

Required?

Example

Original JSON

The JSON you would like to add items to. Provide either an array or a JSON object that contains an array

Text (Long)

Yes

{"items":["value1","value2"]}

New items

The single value or array of items to add to the JSON array. Example: value3 or [“value3”, “value4”]

Text (Long)

Yes

value3 or [“value3”, “value4”]

JSON path location of array

The JSON path to the array where you would like to have the new items added. If Original JSON is an array leave this input as $

Text (Short)

Yes

$.items

Remove quotes?

Select true if you would like to add the new items without quotation marks. This is ideal for adding numbers, booleans, arrays, objects, or strings that already contain quotes

True/False

No

true

Outputs (what you get)

Name

Description

Data Type

Required?

Example

Appended JSON Array

The updated JSON with the new items added to the array

Text (Long)

No

{"items":["value1","value2","value3","value4"]}

Outcomes

Name

Description

Success

This status is selected if the job has successfully completed.

Requirements

  • N/A

Did this answer your question?