Reference

JSON

Encode

Input A map or a list. Other types will throw an error.
Output A JSON string encoding of the value.

Signature

json_encode(a: Any): String

Example

json_encode({"name": "Alice", "age": 30}) // returns '{"name":"Alice","age":30}'

Decode

Input A JSON string.
Output A value parsed from the JSON string (map, list, number, string, or boolean).

Signature

json_decode(a: String): Any

Example

json_decode('{"name":"Alice","age":30}') // returns {"name": "Alice", "age": 30}