Nodes/Comfyui-PixNodes/JSON Unpacker (PixNodes)
ComfyUI Node

JSON Unpacker (PixNodes)

Flatten a JSON structure into a plain string

By pixixai·Created 8 months ago·Updated 6 months ago· 24
JSON Unpacker (PixNodes)
  • json_data
  • text
delimiters\n ,
keep_keyfalse

JSON is great for machines and miserable for text boxes. JSON Unpacker is the opposite direction: it flattens a JSON structure - lists, dicts, nested everything - into a single plain string, using per-level separators you control. It's the "turn this back into something a prompt box, a filename, or a display can read" node.

The behavior is best understood through the delimiters field, which defaults to the two-line string \n then ,. The first line is the separator at depth 0, the second at depth 1, and it repeats the last one for anything deeper. So the default flattens a list of dicts like this:

shot one
,shot two
,shot three

Each level of nesting gets its own separator, which is how you keep the output legible instead of one run-on line. The keep_key toggle (default off) adds key:value pairs for dict entries - turn it on when the field names matter and you'd lose them otherwise.

How it handles messy input

The node is unusually defensive about what you throw at it. A string input gets run through a "smart parse": it tries json.loads, then a Python literal parser, then - and this is the part that stands out - it will actually repair truncated JSON. If your input is cut off mid-structure, it balances the braces and brackets and parses the fixed result. That's a gift for anyone piping output from an LLM node that occasionally cuts its own response short.

Input is json_data (wildcard - string, dict, list, int, all fine). Output is a single text (STRING).

Install

Part of Comfyui-PixNodes. ComfyUI Manager → search "PixNodes" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/pixixai/Comfyui-PixNodes

then restart. (The README's manual-install block references the wrong repo, ComfyUI-AlignLayout - use the URL above.)

Where it slots in

This is the escape hatch for the pack's post-1.0.8 JSON convention, where JSON ports carry Python objects instead of strings. When you need actual text - a prompt, a caption, a display string - run the object through here and you've got a STRING a normal node will accept. It also plays well with the Load Text from Folder and text side of the pack for turning structured data into something human. The one thing it won't do is pretty-print with indentation; if you want formatted JSON for eyeballing, this flattener isn't that - it's for handing data off to a text consumer.

CategoryPixNodes/JSON

Inputs (3)

NameTypeDefaultDescription
json_data*
delimitersSTRING\n ,
keep_keyBOOLEANfalse

Outputs (1)

NameTypeDescription
textSTRING