Nodes/honda-nodes/πŸ“‘ JSON Preview
ComfyUI Node

πŸ“‘ JSON Preview

Read the metadata blob as a tree, copy the jq path, move on

By AvarayΒ·Created 14 days agoΒ·Updated 12 days agoΒ· 0
πŸ“‘ JSON Preview
    • JSON Pass-through
    β—„json_inputβ€”β–Ί

    Every PNG that comes out of ComfyUI is carrying a full node graph plus a flattened copy of the prompt inside it, as text chunks - that's the convention the whole sharing culture runs on. Which means the first time you want to do something with that metadata programmatically, you get handed a several-thousand-character wall of JSON in a string socket and no way to look at it. JSON Preview is the obvious fix, and it does one thing better than a text dump.

    How it works

    The Python side is almost ludicrously small: it takes the string you connect, passes it straight through, and attaches a UI payload keyed json_tree. The actual work happens in the pack's frontend extension (web/js/json_preview.js), which intercepts that payload when the node executes and builds a real DOM tree in the node body - collapsible branches, arrays indexed, strings truncated if you ask it to.

    Two details in that frontend are worth knowing because they make the node useful rather than decorative.

    First, every key gets a small hover-reveal button that copies a jq-compatible path, not a JavaScript one - .foo.bar[0], and .foo["key with spaces"] when it has to fall back to bracket notation. That's exactly the argument format JSON Set Key and JSON Get Value want, so the workflow is: preview the blob, click the path you want, paste it into the Set Key node, never type a path by hand.

    Second, it fixes a Python-only quirk. Python's json.dumps happily emits bare NaN and Infinity, which are not legal JSON and blow up JSON.parse in the browser. The extension sanitises those before parsing, so a blob that came out of a Python node still renders instead of leaving you with a blank box.

    The inputs and outputs that matter

    There's one input, JSON String, and it's a forced input - you cannot type into it, you have to connect a STRING (the Metadata output on Load Image, Read File, JSON Merge, a Text node with a paste in it). One output, JSON Pass-through, which is the string you gave it, unchanged. Wire that onward to whatever actually consumes the JSON.

    The node body also carries two checkboxes in its toolbar: Auto-collapse siblings (only one branch open at a time, which is how you survive a 4000-line workflow chunk) and Limit string length (truncates long values to a sane preview length). Both are view-only - they never touch the data going downstream.

    It's registered as an output node, so it always executes and the engine walks backward from it. That's what you want during exploration, and it's also why you can preview a branch that nothing else touches.

    How to install it

    Part of Avaray/honda-nodes. ComfyUI Manager β†’ Node Pack β†’ search Honda Nodes β†’ Install β†’ restart. Or:

    cd ComfyUI/custom_nodes
    git clone --depth 1 https://github.com/Avaray/honda-nodes.git
    cd honda-nodes
    python install.py
    

    install.py matters even for this node, because the pack's other JSON nodes shell out to jq and the downloader fetches that binary into bin/. No pip dependencies beyond the ComfyUI frontend package, no models.

    Common issues

    You get a working node body but no tree. Either the string isn't valid JSON, or the frontend extension didn't load. The extension is served from the pack's web/ directory as /extensions/honda-nodes/ - after installing or updating, do a hard browser reload (Ctrl/Cmd+Shift+R) and check the browser console for a 404 on json_preview.js. Cached frontend JS is the single most common reason a node looks installed but behaves like a dumb pass-through.

    It only shows the tree after you hit Run. Correct - the payload arrives with execution results, not when you drop the node. There's no live preview while you type.

    Long strings are cut off. That's the Limit string length toggle in the toolbar; uncheck it if you actually want to read a whole prompt.

    Everything is a wall of text anyway. Turn on Auto-collapse siblings and start from the top. The workflow chunk in a ComfyUI PNG is enormous and mostly node positions - you usually want the prompt chunk, or the smaller custom/exif structure if you're reading what the pack's ime backend wrote.

    Category⚑️ Honda Nodes/πŸ“‘ JSON

    Inputs (1)

    NameTypeDefaultDescription
    json_inputSTRINGThe JSON string you want to preview.

    Outputs (1)

    NameTypeDescription
    JSON Pass-throughSTRINGβ€”