Reference · reference
json module
use json parses and serializes JSON over the Value type. config-weave registers it from wscript-std. Only parse can fail; it returns Result[Value, string]. Serialization sorts map keys, so the same value always produces the same text and a rewritten file only changes when its content does.
parse
rust
parse
Parses JSON text into a Value. Objects become maps, arrays become lists and null becomes Value::Null.
to_string and to_string_pretty
rust
to_string to_string_pretty Serializes a Value as compact JSON, or as indented JSON. Keys are emitted in sorted order.
rust
use fs
use json
let cfg = parse?
let enabled = match cfg.get Some => v.as_bool.unwrap_or,
None => false,
}