JSONMakeArray

Converts a list of separated values into a JSON array of the specified type.

Format 

JSONMakeArray ( listOfValues ; separator ; type )

Parameters 

listOfValues - a list of separated values.

separator - text that separates one value from the next (an empty string means any line separator).

type - a numeric value that specifies the type of data in the array. Use the same numeric values as for the type parameter in the JSONSetElement function.

Data type returned 

text

Originated in version 

21.0

Description 

For listOfValues, this function returns a JSON array of values. Each value must be separated by the character you specify in the separator parameter.

Notes 

  • If separator is an empty string, then listOfValues can be separated by any line separator (carriage return, line feed, or other Unicode line or paragraph separator characters).

Example 1 

JSONMakeArray ( "34,600,18,600,18.0" ; "," ; JSONNumber ) returns:

Copy
[34,600,18,600,18]

Example 2 

When the Product::Colors field contains

Copy
green
red
yellow

JSONMakeArray ( Product::Colors ; "" ; JSONString ) returns:

Copy
["green","red","yellow"]

Example 3 

When the Bakery::Product field contains

Copy
{"id" : "FB1", "name" : "Donuts" } #
1.99 #
true #
null #
"Breads"

then

Copy
JSONFormatElements ( 
    JSONMakeArray ( Bakery::Product ; "#" ; JSONRaw )
)

returns

Copy
[
    {
        "id" : "FB1",
        "name" : "Donuts"
    },
    1.99,
    true,
    null,
    "Breads"
]