std.json [core] std.json.Value pub enum Value { Null, Bool(bool), Int(int), Num(f64), Str(str), Arr(List[Value]), Obj(Map[str, Value]), } — A JSON value. std.json.depth_limit pub fn depth_limit() -> int — The nesting depth this module reads and renders before raising deep — one number for parse, stringify and stringify_pretty, so a value that came in can always go back out. std.json.null pub fn null() -> Value — The JSON null. std.json.from_bool pub fn from_bool(b: bool) -> Value — A JSON boolean. std.json.from_int pub fn from_int(n: int) -> Value — A JSON number that is an integer, kept exact — the posture the module header describes. std.json.from_num pub fn from_num(x: f64) -> Value — A JSON number that is not (or need not be) an integer. std.json.from_str pub fn from_str(s: str) -> Value — A JSON string. std.json.from_list pub fn from_list(xs: List[Value]) -> Value — A JSON array over an already-built list of values. std.json.from_map pub fn from_map(m: Map[str, Value]) -> Value — A JSON object over an already-built map. std.json.type_name pub fn type_name(v: Value) -> str — The variant's name — "null", "bool", "int", "num", "str", "arr" or "obj". std.json.is_null pub fn is_null(v: Value) -> bool — Whether v is the JSON null. std.json.as_bool pub fn as_bool(v: Value) -> bool ! {kind} — The boolean v holds; kind when it holds something else. std.json.as_int pub fn as_int(v: Value) -> int ! {kind} — The integer v holds; kind for every other variant, Num included. std.json.as_float pub fn as_float(v: Value) -> f64 ! {kind} — The number v holds as f64; kind for every non-numeric variant. std.json.as_str pub fn as_str(v: Value) -> str ! {kind} — The string v holds, unescaped (the model stores text, not JSON source); kind otherwise. std.json.as_arr pub fn as_arr(v: Value) -> List[Value] ! {kind} — The array v holds; kind otherwise. std.json.as_obj pub fn as_obj(v: Value) -> Map[str, Value] ! {kind} — The object v holds; kind otherwise. std.json.has pub fn has(v: Value, key: str) -> bool — Whether v is an object with an entry at key. std.json.get pub fn get(v: Value, key: str) -> Value ! {kind, none} — The value at key; none when the object has no entry there, kind when v is not an object at all. std.json.at pub fn at(v: Value, i: int) -> Value ! {kind, none} — The element at i; none when i is outside the array, kind when v is not an array. std.json.keys pub fn keys(v: Value) -> List[str] ! {kind} — The keys of an object, in the map's unspecified order; kind for every other variant. std.json.len pub fn len(v: Value) -> int ! {kind} — The number of elements in an array or entries in an object; kind for every scalar. std.json.parse pub fn parse(s: str) -> Value ! {syntax, deep, overflow} — s parsed as one JSON document — the direction this module could not go for eight sprints. std.json.escape pub fn escape(s: str) -> str — s with the characters JSON forbids inside a string replaced by their escapes: " and \ by their backslash forms, and every control character below U+0020 by \b, \f, \n, \r, \t or \u00XX. std.json.unescape pub fn unescape(s: str) -> str ! {syntax} — s with JSON's escapes resolved — escape's inverse, and the function parse reads every string payload through. std.json.stringify pub fn stringify(v: Value) -> str ! {deep} — v rendered as compact JSON text — no spaces, no newlines, keys in the map's unspecified order. std.json.stringify_pretty pub fn stringify_pretty(v: Value, indent: int) -> str ! {deep} — v rendered as JSON text with indent spaces per nesting level and one entry per line — the human-readable form.