to_json

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()