π JSON Get Value
One jq filter, straight into a prompt
- Result
The node that turns a file's insides into a wire
Every PNG this ecosystem produces carries its own provenance: the prompt, the workflow, the seed, the model. Usually you read it by dragging the image onto the canvas and squinting at nodes. JSON Get Value lets the workflow read it - feed it metadata JSON and a jq filter, and it returns the value as a string you can plug into a prompt encoder, a filename, or a comparison.
That's the hinge of the whole pack. π·οΈ Extract Metadata gets the JSON out of a file; this node reaches into it. Pull the positive prompt out of an old generation and reuse it. Pull the seed and feed it back to a sampler to continue a run. Build a little archive-vs-archive comparison, or an "extract the caption from every image in this folder" pipeline with π List Files β π Array For Each β Extract β this.
How it works
It pipes your JSON into jq and returns stdout. Practical consequences:
- A bare key gets a dot prepended. Type
nameand it becomes.name. Type.data[0].idand it's used as-is. Forgetting the leading dot is the first thing everyone does, and the node has decided to forgive it. raw_outputmaps to jq's-rflag, and it's on by default. This is the setting you want, always, for anything going into a prompt or a filename: with-ra JSON string comes back as its contents (a cat), without it you get the JSON encoding back ("a cat"), quotes included. That's the difference between a working prompt and one with literal quotation marks in it.- Empty input returns an empty string rather than erroring, which is friendly in a pipeline and slightly alarming when you're debugging silence.
- A bad filter throws. jq exits non-zero, the node raises
jq failed (exit code N)with jq's stderr inline. Read that stderr; jq is unusually good at saying which character broke it. - It's an output node, registered so that it runs even with nothing connected to
Result- which is why the node shows the extracted text in its own preview. Nice for the "just show me the prompt in this PNG" use case with zero downstream wiring.
Inputs and output
JSON Data is socket-only (force_input), default {}. You can't paste into it; wire it from Extract Metadata, π JSON Merge, π JSON Set Key, π Read File on a .json, or a text node if you're testing.
jq Filter - the actual work. .prompt gets the ComfyUI API prompt, which for a normal save is a JSON object of nodes rather than a string, so a useful filter is usually something like .prompt[<node id>].inputs.text - or, more practically, .workflow.nodes[] | select(.type=="CLIPTextEncode") | .widgets_values[0] if you're prepared to iterate. Simple paths are easy; making jq sing takes ten minutes of reading its manual and pays for itself.
Raw Output (-r) - leave it on unless you're handing the result to another JSON node, where the quoted form may be what it wants.
One output: Result (STRING). Into a CLIP Text Encode, a π Delete File path, π€ Text Preview, or another JSON node as a nested value.
A realistic caveat
This is a power tool with a fiddly grip. The ComfyUI prompt chunk is API-format JSON - node IDs as keys, values under inputs - and the workflow chunk is the UI graph with positions and links. Neither has a stable schema across ComfyUI versions, and a filter written against a workflow that embeds one CLIPTextEncode will return nothing useful for one that embeds two. If you're building a filter to reuse, test it on three files, not one.
And remember the starting condition: metadata only exists if it wasn't stripped. PNGs out of Save Image have it. Anything that came back from Reddit, or went through a JPEG conversion, doesn't - and no jq filter recovers a chunk that isn't in the file.
Install
Manager: Extensions β Node Pack β search "Honda Nodes" β Install β restart. Manual installs must run the setup step, or you'll get "The 'jq' CLI tool was not found":
cd ComfyUI/custom_nodes
git clone --depth 1 https://github.com/Avaray/honda-nodes.git
cd honda-nodes
python install.py # ComfyUI's python; portable Windows: ..\..\..\python_embeded\python.exe install.py
That drops a platform-correct jq binary into honda-nodes/bin; if jq is already on your PATH it'll be used first. Pack requires ComfyUI 0.38.0+ (V3 schema only).
Common issues
Result has quotes around it. Turn Raw Output back on⦠or, if it's already on, your filter returned a JSON object or array rather than a string, and jq pretty-prints those. Add | tostring or | .[0] to narrow it.
Result is null. jq found no match. Either the path is wrong or the key isn't in this file's metadata. jq returns null rather than failing for a missing key, so this is silent by design - check the shape first.
"jq failed" with a parse error mentioning an escape. Your JSON has a Windows path with single backslashes in it: "C:\Users\me" contains an invalid \U escape. Double the backslashes, or | gsub("\\\\"; "/") if you're in the mood.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| json_data | STRING | {} | The JSON string to process. |
| jq_filter | STRING | . | The jq filter to apply, e.g., '.data[0].id' or '.name'. |
| raw_output | BOOLEAN | true | If enabled, outputs raw strings instead of JSON-encoded strings (adds -r flag). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Result | STRING | β |