Context
The json module currently exposes only encode, decode, pretty_print, is_valid. That is barely enough to be useful — users cannot pull a nested value out of a decoded object without verbose manual traversal.
A dedicated JsonValue tagged union was considered and rejected for now. Stay with generic maps.
Approach
Vendor cJSON (small, permissive, C) under ezc/vendor/cjson/. Same pattern as sqlite.
Additions
get(obj, "path.to.key") — dotted path accessor, returns value or null
has(obj, "path.to.key") — existence check
set(obj, "path.to.key", value) — set value at path, creating intermediate objects as needed
remove(obj, "path.to.key") — delete a key at path
keys(obj) — top-level keys
type_of(value) — return "null" / "bool" / "number" / "string" / "array" / "object"
Out of scope
- Streaming decode
- Schema validation
- Typed unmarshaling into structs (revisit in 3.1)
Target
3.0 GA
Context
The json module currently exposes only
encode,decode,pretty_print,is_valid. That is barely enough to be useful — users cannot pull a nested value out of a decoded object without verbose manual traversal.A dedicated
JsonValuetagged union was considered and rejected for now. Stay with generic maps.Approach
Vendor cJSON (small, permissive, C) under
ezc/vendor/cjson/. Same pattern as sqlite.Additions
get(obj, "path.to.key")— dotted path accessor, returns value or nullhas(obj, "path.to.key")— existence checkset(obj, "path.to.key", value)— set value at path, creating intermediate objects as neededremove(obj, "path.to.key")— delete a key at pathkeys(obj)— top-level keystype_of(value)— return "null" / "bool" / "number" / "string" / "array" / "object"Out of scope
Target
3.0 GA