XAV Navigate JSON
Drill into nested JSON one level at a time — and watch for the silent nulls
- json_ref
Loading a JSON file hands you the whole object. Most real JSON is nested - {"settings": {"theme": "dark"}}, or a list of items - and this is the node that digs in. Give it a json_ref and a key, and it hands you a new ref pointing at the piece you asked for.
The key is one level, one string. Point it at a dict and the key is a property name: key settings gets you the whole settings object. Point it at a list and the key is an index written as text: "0" gets you the first element, "1" the second. There's no "a.b.c" dot-path magic - to go three levels deep you chain three Navigate nodes, one per level. That's clunkier than it could be, but it does make the path visible on the canvas, which is arguably the point.
Two behaviors matter, and both come straight from the source.
Missing keys are silent. If the key isn't in the dict, or the index is out of range, you don't get an error - you get a ref pointing at None. From there, XAV JSON to Primitives quietly hands you 0 / 0.0 / False / "" as if the value had existed. Chain two or three of these deep and you've built a silent wrong-answer machine: the workflow runs green and the numbers are just wrong. If you can't figure out why a branch is producing zeros, walk back to the navigate and check your key spelling and the actual JSON.
You get a fresh ref every call. Navigation never mutates anything - it just returns a handle to the sub-object. And because refs share the underlying Python objects rather than copying them, if you modify the sub-object with XAV Set JSON Value, the parent's copy changes too. Reference semantics all the way down. Usually that's what you want; just don't expect snapshots.
One more edge: point Navigate at a leaf - a string or number - and there's nothing to navigate into, so you get a None ref. Only dicts and lists have keys.
The typical pipeline: XAV Load JSON File → one or more Navigate nodes to walk down → XAV JSON to Primitives to pull out a value, or XAV Set JSON Value From Ref to lift a whole loaded block into something you're assembling → XAV Save JSON to File when you want the result on disk. Nothing serializes until that final save, which is why this stays fast even on big files.
A practical tip for debugging: when a path is deep, add Navigate nodes one at a time and connect XAV Save JSON to File at each step to see what you actually landed on. Ten seconds of inspection beats guessing at a chain of nulls.
Install is the easy part - this pack is pure Python stdlib, zero dependencies, no pip install, no models. ComfyUI Manager → Install Custom Nodes → search "ComfyUI XAV JSON Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/XAV-Games/ComfyUI-XAVJsonNodes
Restart ComfyUI and all seven nodes appear under Add Node → XAV/json. (The README's clone command has a your-username placeholder - use the real repo above.)
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json_ref | STRING | — | |
| key | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json_ref | STRING | — |