To Json

Get a String representing the contents of the array in JSON notation.

to_json operates on an Array. It returns a String representing the contents of the array in JSON notation.

Usage:

Array.to_json()

or

to_json(array)

Returns:

String: A representation of the array content in JSON syntax.

Example:

set myarray = {

"one": "val one",

"two": {

"x": 3,

"y": 4

}

};

echo ${myarray.to\_json()};

// echoes {"one":"val one","two":{"x":"3","y":"4"}}

See Also:

filter(), sum()

Last modified December 18, 2020: reorganzise sections (85d5aef)