JSON.encode()
Description
Serializes a values in JSON format.
This method returns a Data for the formatted text. When a string is needed, use JSON.stringify() instead, which could be a bit lower in performance.
Syntax
JSON.encode(value)
Parameters
encode(value, replacer?, space?)
valuereplacer?space?
A value of any type to serialize in JSON format.
A callback function that receives a value being serializing via its three parameters (key, value and container) and returns a replacement value to be serialized instead.
Number of spaces for the indentation, or zero for no indentation. Default is 0.
Return Value
A Data object after serialization.