PreviewJSONNode
Actually read the JSON your nodes spit out — pretty-printed, right on the canvas
- STRING
A lot of nodes answer in JSON - this pack's ImageCheveretoUploader and JSONMessageNotifyTool are the obvious examples, but plenty of API and metadata nodes do it too. And a JSON blob is a pain to read in ComfyUI's default view: you hover over the output, or dig through the console, squinting at a minified one-liner. PreviewJSONNode fixes the exact annoyance: feed it a JSON string and it pretty-prints the thing into a read-only text widget on the canvas, while also passing the original string through so your data keeps flowing.
It's one of the eight utilities in ComfyUI-Image-Tools, and it's the pack's only node with a JavaScript companion - the widget that shows the text is registered by js/tools.js. In plain terms: it's a debugging and observability node. Stuck it at the end of a chain to see what came back, and you'll actually know what your pipeline is doing.
How it works
The core is two JSON calls: json.loads(text) validates the input, then json.dumps(..., indent=4) reformats it into readable, indented JSON. That pretty string is pushed to the read-only multiline widget on the node via the JS extension, and the original string is echoed out as the node's output. Because it's marked as an output node (OUTPUT_NODE = True), ComfyUI treats it as a terminal - the graph finishes here, which is what you want for a preview point.
Inputs and outputs
text(STRING, force input) - the JSON string to preview. It wants a wire, not a typed value, so connect the STRING output of an earlier node to it.- Output:
STRING- the original input string, passed through untouched. Preview is a side effect; the data survives for the next node.
Install
It ships in a pack, so install the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/knuknX/ComfyUI-Image-Tools
Restart ComfyUI, or install Image Tools via ComfyUI Manager. The JS extension loads automatically; no Python dependencies beyond the standard library.
Where people get burned
- The input must be valid JSON.
json.loadsis strict - feed it a plain string, a trailing comma, or truncated data and the node errors instead of showing you anything. It's a JSON formatter, not a general text previewer; for arbitrary text you want a Show Text / text preview node instead. - The pretty display is a browser-side widget. It fills in when the node executes (
onExecuted), and repopulates when you load a saved workflow. If the JS extension ever fails to load - a stale browser tab, a cache issue - you lose the visible preview, though the pass-through output still works, so you can recover the data via the console. - It's a terminal, not a transformer. The reformatted text doesn't go anywhere except the widget; the output carries the raw original. If you wanted the pretty version as data, this won't give it to you.
For a pack that's mostly IO plumbing, PreviewJSONNode is the bit of polish that makes the rest usable - you can finally see what the uploader uploaded and what the notifier's server replied. It's not glamorous, but every workflow that produces JSON should end in one.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |