Get Object From JSON
Drill into nested JSON
- json
- JSON
Where GetTextFromJson pulls a single string out of a JSON blob, this one pulls out a whole sub-object - a nested piece of the structure that's still JSON, so you can keep digging into it. It's the navigation node in ArtVenture's JSON toolkit. When your data is deep - an object inside an array inside an object - you use GetObjectFromJson to step down a level or two, then hand the smaller piece to a text/int/float extractor for the actual value.
You reach for it whenever the thing you want isn't at the top of the JSON. An API returns {"result": {"images": [{"prompt": "..."}]}} and the prompt is buried three levels down. Rather than write one enormous key path and hope, you drill: grab result, then result.images.[0], then the string. Each hop is a node, each node is checkable, and a broken path is easy to spot because you can see exactly which level failed.
How it works
It takes a JSON value and a key path, walks into the structure, and returns whatever it lands on - still typed as JSON, so it chains. The path syntax is the same across all the ArtVenture Get nodes: key.[index].subkey.[sub_index], where bracketed numbers index into arrays. Because the output stays JSON, you can feed it into another GetObjectFromJson to go deeper, or into GetTextFromJson once you've reached the object holding your leaf value.
Inputs and outputs
Two required inputs:
json- the JSON value to read from, wired in from LoadJsonFromUrl, an LLM node, or an upstream Get node.key- the dotted path to the sub-object you want. Empty means top level;data.items.[0]reaches into a nested array element.
The output is JSON - the extracted sub-object, ready to chain into another extractor.
Installing it
Part of the ArtVenture pack. ComfyUI Manager: search comfyui-art-venture, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/sipherxyz/comfyui-art-venture
Restart ComfyUI. No model downloads - the JSON nodes are pure Python and load instantly.
Common issues
Empty or wrong sub-object. The key path doesn't match the real structure. Load the source with print_to_console on (in LoadJsonFromUrl) so you can read the actual shape, then copy the path exactly. Array indices need the bracket form - items.[2], not items.2.
You wanted a value, not an object. GetObjectFromJson gives you back JSON. If you've reached the leaf and want the actual string, number, or bool, switch to GetTextFromJson (or the Int/Float/Bool variants) for that final hop. The usual pattern is Object nodes for the middle of the path, a typed extractor at the end.
Trying to do it all in one giant key. You can, but a deep single path is a pain to debug. Splitting the descent across two or three GetObjectFromJson nodes makes it obvious where a mismatch is, which saves more time than the extra nodes cost.
Nothing flowing. Make sure the upstream node actually emits a JSON value, not raw text. If you're holding a JSON string, parse it first with a loader - these nodes expect an already-parsed value.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json | JSON | — | |
| key | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| JSON | JSON | — |