JSON Formatter (Soze)
Pretty-print and minify in one node
- formatted_json
- minified_json
The more your workflow leans on JSON - metadata blobs from an API node, a config you're building on the fly, output you're about to hand to something else - the more you need to actually look at it while you're building the graph. Node text widgets show JSON as one long unreadable line unless you format it yourself. JSON Formatter takes a JSON string and gives you back two clean versions: one indented for reading, one squeezed for storage.
It's a small, unglamorous node, but it's the one you reach for constantly once you start doing anything JSON-driven in ComfyUI, because eyeballing a malformed JSON string inside a cramped text widget is genuinely miserable.
How it works
Feed it any JSON string and it parses it, then serializes it back out twice: once pretty-printed with indentation so you can actually read the structure, once minified with whitespace stripped so it's compact for passing along or storing. Parsing it also functions as implicit validation - if your JSON string is malformed, this is where you'll find out, rather than three nodes downstream where the error message is far less obvious.
The inputs and outputs that matter
json_string- required, multiline text input. Paste or wire in any JSON string.- Output:
formatted_json- the indented, human-readable version. Good for a debug branch you look at while building the graph, or for writing to a file you might open later. - Output:
minified_json- the compact, whitespace-stripped version. Use this one when you're passing the JSON further downstream (into an API call, a save node, another JSON node) and don't need it to be pretty, just small.
How to install it
Via ComfyUI Manager: search "Quality of Life Nodes for ComfyUI" or "Soze." Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/SozeInc/ComfyUI_Soze.git
pip install -r ComfyUI_Soze/requirements.txt
Restart ComfyUI. This node has no model or GPU dependency and doesn't touch any of the pack's optional integrations, so none of the ComfyDeploy/FAL/ElevenLabs API keys the README mentions apply here.
Common issues & troubleshooting
It errors on input that "looks like JSON." Trailing commas, single quotes instead of double quotes, unquoted keys - all common in hand-typed test data, all invalid JSON. If this node throws, the fix is almost always fixing the string itself, not the node; run it through any online JSON validator to see exactly where it breaks.
You copy-pasted from a Python print() and it doesn't parse. Python dict reprs use single quotes and True/False/None instead of JSON's true/false/null - they look like JSON but aren't. If your source is Python rather than an actual API response, convert it with json.dumps() on the Python side before it reaches this node.
You only need one of the two outputs. That's fine - ComfyUI doesn't require you to wire every output. Leave formatted_json disconnected if you're only after the minified version, or vice versa.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| json_string | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| formatted_json | STRING | — |
| minified_json | STRING | — |