Light Dark

Functions

from-json core

fn (value: Str): Any

Deserialize a JSON string to a value.

Example

from-json("{\"name\":\"Alice\"}")
// {"name": "Alice"}

from-json("[1,2,3]")   // [1, 2, 3]
from-json("true")      // true
from-json("null")      // null

to-json core

fn (value: Any): Str

Serialize a value to a JSON string.

Example

to-json({"name": "Alice", "age": 30})
// "{\"name\":\"Alice\",\"age\":30}"

to-json([1, 2, 3])   // "[1,2,3]"
to-json(true)        // "true"
to-json(null)        // "null"