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()
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified August 31, 2024: Signed-off-by: tracyragan <[email protected]> (20379ca)