JSON KV Split (PixNodes)
Deconstruct a JSON object into keys, values, and a count
- json_data
- keys
- values
- count
The inverse of "join things into JSON" is "take JSON apart," and JSON KV Split is the disassembly node for the simplest case: an object whose keys and values you want as two parallel lists, plus the count so you know how many you've got. It's a small node with a very specific job, and it does that job well.
Where it shines is feeding a loop or an iterator. ComfyUI loops iterate over lists, not dictionaries - so if you want to walk the entries of a JSON object one at a time, you need its keys in a list first. That's exactly what this node hands you.
How it deconstructs
The input json_data accepts anything - a dict, a list, a JSON string, even a scalar - and the output shape adapts:
- Dict in:
keysis the list of key names,valuesthe matching values, in insertion order. - List in:
keysbecomes stringified indices ("0","1","2", …),valuesthe actual items. Handy for pairing an index with its item. - Scalar in: treated as a single-element collection, defensively.
If the input is a string, the node first tries json.loads on it, so you can feed it a raw JSON text block without a separate parse step. Outputs are three: keys (LIST), values (LIST), and count (INT) - the length, which is the number you'll actually use to size a loop.
Wiring it up
The natural flow is Join JSON Object (or any JSON source) → JSON KV Split → feed the keys list into a for-loop start, and pull the matching values by index inside the loop. The count output is there so the loop knows how many iterations to run. Since the type is wildcard (*), anything plugs in.
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.) No models, no extra deps.
The fine print
The values list can hold mixed types - numbers, strings, nested dicts - because it's a straight extraction; whatever the object contained is what comes out. If a downstream node needs homogeneous input, you'll want to pluck or filter first. Also note the keys come back as strings even when the input was a list (they're indices). If you need the actual index as an integer, the loop's own index port is probably the cleaner source. For the core job - turning a dict into iterable parts - this is a tidy, dependency-free way to get there.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| json_data | * | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| keys | LIST | — |
| values | LIST | — |
| count | INT | — |