Json
The Json class provides utilities for serializing and deserializing JSON.
let alice_json be quote
| \{
| "name": "alice",
| "age": 29,
| "active": true,
| "roles": [
| "admin",
| "designer",
| "editor"
| ]
| }let alice_object be object with
name as "alice",
age as 29,
active as true, and
roles as list with
"admin",
"designer", and
"editor"With this class you can easily parse JSON strings into values.
let new_object be Json's decode alice_jsonAnd vice-versa, optionally with pretty printing via indents.
let new_json be Json's encode with alice_object, and 2Static Functions
Returns a JSON string given the value, and an indent string. If indent is an integer,
the indent is that amount in spaces.
- Throws a JsonError if the value isn't serializable.
Serializes the given json into a value.
- Throws a JsonError if unable to parse.
print "hello world"