Standard Library
std.json
JSON values with checked parsing and schema validation.
Exported functions
pub def encode[T](value: T) -> String
Encode a value as JSON. Use Dynamic explicitly for heterogeneous dictionaries and lists.
pub def decode[T](text: String) -> T ! DecodeError
Parse JSON and validate every nested value against T before returning. Supports Int, Float, Bool, String, List, Dict, optional values, and Dynamic. JSON objects remain dictionaries; nominal structs require explicit construction.
Examples
use json from "std.json"
const config = json.decode[Dict[String, String]](`{"theme":"dark"}`)
@println(config["theme"] ?? "default") # dark