JSONARRAY Function

From Planfix
Jump to: navigation, search

The JSONARRAY() function returns a string formatted as a valid JSON array from a variable.

Format

JSONARRAY(Variable)

Example

This function is typically used when sending JSON data in POST requests.

For example, if you send a list of phone numbers in a POST request, you can use the variable {{Task.Counterparty.Phones as list}}. Planfix will then automatically convert the data into the correct format. If the task has no counterparty or the counterparty is not specified, an empty JSON array is inserted instead of the variable.

{
    phones: %%% JSONARRAY({{Task.Counterparty.Phones as list}}) %%%
}


Result:

{
    phones: []
}


Go To