json-stringify()
Serializes a JSON (OXN) object or an atomic value (string, number, boolean) into JSON text.
The compact (unpretty) form (default) is useful for logging as it contains no line breaks.
Parameters
json
: A JSON object/array or atomic valuepretty
: A boolean indicating compact or pretty formatting
Examples
json-stringify(true())
→true
json-stringify(42)
→42
json-stringify("foo")
→"foo"
json-stringify($data)
→{"foo":"bar"}
json-stringify($data, true())
→json-stringify(json-parse('[1, 2]'))
→[1, 2]
See also
Last updated