JsonGetValueByKeys(NYJY)
Pull a value out of nested JSON with a dotted path
- json_data
- result
JSON arrives in ComfyUI all the time - an API response, a workflow config, an LLM's structured output - and it's almost always nested. {"meta": {"creator": {"name": "aidenli"}}} - how do you get aidenli out without a full programming environment? JsonGetValueByKeys is the pack's answer: you give it the JSON object and a dotted key path, and it walks the structure and returns the value as a STRING. It's like jq for your node graph, minus the learning curve.
How it works
The node takes your key and splits it on dots - meta.creator.name becomes three steps - then walks the data structure one step at a time. If a path segment is all digits it's treated as a list index (0 picks the first element of an array), so it handles arrays inside your JSON too, not just dicts. Missing keys, out-of-range indexes, or walking into the wrong type all return an empty string rather than failing the node - which is forgiving, but also means you have to know the difference between "value is empty" and "path is wrong."
Inputs and outputs
- json_data - required, type
JSON. Feed it the pack's JSON type (fromJsonLoadsor wherever the pack hands you JSON). - key - required STRING. The dotted path, e.g.
meta.creator.nameoritems.0.titlefor the first item's title.
Output: result, a STRING of the value found (or empty if nothing matched). Note the value comes back as text - a numeric JSON value like 42 comes out as the string "42", so route it through ConvertStringToNumber if you need a real number.
Installing
Standard pack install: ComfyUI Manager → Install via Git URL → https://github.com/aidenli/ComfyUI_NYJY, restart.
Where it earns its keep
This is the node that makes API and LLM output usable. An LLM answers with JSON, JsonLoads turns it into a JSON object, and this node extracts the single field you care about to drive the rest of the graph - the seed, the prompt, the filename, whatever. It's the companion to JsonDumps: dumps serializes to string for output, this extracts from JSON for consumption.
The one thing that trips people: the empty-string-on-failure behavior. Because a wrong path silently yields "", a typo in your key won't announce itself - it'll just propagate an empty string downstream. If you see blank output, triple-check the path against the actual structure first, and use JsonDumps + a display node to eyeball the real JSON before you trust your path. Get the path right and this node is surgical.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json_data | JSON | — | |
| key | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | STRING | — |