Expand description
Dotted-path JSON operations.
Four pure functions over serde_json::Value:
path_get— read the value at a dotted path,Noneif missingpath_set— write a value at a dotted path, auto-vivifying objects and growing arrays withnullpaddingpath_has— test for presence- [
path_delete— remove a key/index; returnstrueif something was removed
Numeric segments are interpreted as array indices when the current
node is an array; otherwise they’re treated as object keys (so
map.0.name is a valid path into {"0": {"name": …}}).
Used by __hypen_bind (renderer → state) and by every host SDK’s
ObservableState implementation. Centralising here removes four
hand-ports of the same auto-vivification semantics.
Functions§
- path_
delete - Remove whatever lives at
path. Returnstrueif a key/index was actually removed,falseif the path didn’t resolve. Array indices are removed by splicing (the array shrinks by one). Empty path is a no-op that returnsfalse. - path_
get - Read the value at a dotted path. Returns
Noneif any segment fails to resolve. - path_
has - Test whether a dotted path resolves to a value.
- path_
set - Write
new_valueatpathinsidetarget. Intermediate objects are created as needed; arrays are extended withValue::Nullup to the target index. Numeric segments map to array indices only when the current node is already an array.