JSON Array Merge
Collect a list of strings into one clean JSON array
- items
- JSON_ARRAY
Sometimes the JSON you need isn't an object, it's a list. A batch of prompts, a set of tags, a queue of values for an API call. JSON Array Merge is the small, purpose-built node in comfyui-json-nodes that turns a handful of autogrow string inputs into one JSON array string.
How it works
Same autogrow pattern as its sibling JSON Object Merge: the node starts with an item_1 input and ComfyUI adds more sockets as you connect things, up to 64. Each connected input is parsed as JSON first - if json.loads succeeds, you get the typed value (numbers stay numbers, booleans stay booleans, nested objects and arrays come through whole). If parsing fails, the raw text is included as a plain string. That fallback is the whole trick: you can wire in arbitrary text and still get a well-formed array out the other end.
Items are collected in numeric socket order - item_1, item_2, and so on - so the array respects where you connected things, not some arbitrary sort. One behavioral quirk worth knowing: a blank connected input becomes an empty string item in the array, not a skipped slot. Leave an input unconnected and it's simply ignored.
Inputs and output
items- the autogrow string inputs.pretty_print- on by default, so the output renders indented in the UI.
The single output is JSON_ARRAY, a STRING containing the final JSON array.
The naming is a mild lie worth getting straight: this node does not merge existing JSON arrays. Feed it [1, 2] and [3, 4] and you get a nested array [[1, 2], [3, 4]], not [1, 2, 3, 4]. If you want flat concatenation you'd merge the arrays yourself first - or just build the list here, item by item, and let the JSON parsing handle the nesting.
Installing it
It's one of five nodes in olliethomas1992/comfyui-json-nodes, so a single install covers all of them. Through ComfyUI Manager, search comfyui-json-nodes; or by hand:
cd <ComfyUI>/custom_nodes
git clone https://github.com/olliethomas1992/comfyui-json-nodes
Restart ComfyUI and it shows up under utils/json. No models, no extra dependencies - the pack's requirements.txt is empty by design.
Common issues
The one that catches people is expecting a flat array of sub-arrays, described above. Other than that, this is about as friction-free as a ComfyUI node gets: it can't really error on input because invalid JSON just becomes a string. If you need typed values in the array - numbers, booleans, objects - paste them as JSON syntax into the inputs and the parser handles them; if you need a list of plain strings, just type.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| items | COMFY_AUTOGROW_V3 | — | |
| pretty_print | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| JSON_ARRAY | STRING | — |