ComfyUI Node

Dump JSON

Turn any object into a readable string without the debug node tax

By Duanyll·Created about a year ago·Updated 4 months ago· 2
Dump JSON
  • json_object
  • STRING
indent2
max_depth0

Dump JSON is the debug node you'll actually leave in a workflow: it takes any object - a dict from an LLM response, a parsed JSON payload, a model's output - and serializes it to a pretty-printed STRING you can read in a preview widget or pipe into a text node. It's json.dumps with a couple of extras bolted on, which is exactly the right size for the job.

The obvious use is debugging: your LLM or JSON-path node returns a nested object and you want to see it. Feed it into Dump JSON, look at the string, done. But it's also genuinely useful in production: some downstream nodes take a STRING of JSON rather than a live object, and this is the clean bridge. And it handles non-ASCII properly (ensure_ascii=False), so Chinese text in your JSON comes out readable instead of a wall of \uXXXX escapes.

The inputs

  • json_object (required, any type) - whatever you want serialized.
  • indent - pretty-print indentation, default 2. Set to 0 for a compact one-liner.
  • max_depth - the interesting one. Default 0 means no limit; set it to 1–8 and deeply nested structures get truncated so you don't drown in a 500-level-deep response from an LLM that nested everything. If you've ever dumped a big object and scrolled past 40 screens, this is the input you'll reach for.

The single output is STRING, the serialized JSON.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
cd duanyll_nodepack && pip install -r requirements.txt

or ComfyUI Manager → "Duanyll Nodepack" → install → restart. The node needs only the standard json module; the pack's heavy requirements (OpenCV, kornia, insightface, matplotlib, Volcengine SDK) ride along regardless.

Gotchas and the honest take

Two traps. First, this serializes whatever type you feed it - a STRING input gets wrapped in quotes, a MASK tensor becomes an unreadable array dump, because there's no type checking on the wildcard input. Feed it dicts and lists and you're golden; feed it a torch tensor and you'll wonder why the output is nonsense. Second, max_depth truncation isn't marked in the output, so a truncated dump looks complete - if something seems cut off, that's the setting to check.

The caveat that applies to the whole pack applies here too: this is a personal pack, not a community standard, so you're not missing a tutorial ecosystem. But the max_depth feature is genuinely rare among the many "debug JSON" nodes out there, and it's the one that'll actually save you from the 40-screen scroll. Worth having.

Categoryduanyll/data

Inputs (3)

NameTypeDefaultDescription
json_object*
indentoptINT20–8
max_depthoptINT00–8

Outputs (1)

NameTypeDescription
STRINGSTRING