Split text into JSON🐶
Turn a delimited block of text into a proper JSON list
- json_data
An LLM asked for a list often gives you exactly that - a newline-separated block of items in plain prose, not a structured object. That's fine to read, useless to route through a graph that expects actual list data. Split text into JSON is comfyui_LLM_party's fix: give it text and a separator, and it comes back as a proper JSON array.
How it works
text is the block you're splitting; sep (default a newline) is what to split it on. The node breaks the text into pieces at every occurrence of the separator and serializes the resulting list as JSON, returned as a string - the standard way structured data moves through a ComfyUI graph, since sockets generally carry text rather than native Python objects.
The inputs and outputs that matter
text(multiline) - the block to split. Usually an LLM's output, when you've asked it for a list of items but it answered in prose rather than JSON.sep(default\n) - the delimiter. Swap it for a comma, a semicolon, or any custom marker that actually matches how your source text is formatted - the newline default fits a numbered or bulleted list, not necessarily every format an LLM might choose.
Output: json_data (STRING) - the split pieces, serialized as a JSON array.
Where it fits
This pairs naturally with the pack's other JSON tools: once you've got json_data, JSON Get Value or JSON File Parser is how you read a specific piece back out later, and this pack's iterator or combine nodes are common next steps once you've got a real list instead of a wall of text. The trio you'll see used together on a real workflow: get an LLM to produce a list in prose, split it into JSON here, then process each item downstream.
It's worth comparing to asking the LLM to just emit JSON directly in the first place, which several of this pack's other nodes are built around (custom_persona's templating, the LLM node's own prompt shaping). Both approaches get you to the same place - this node exists for the case where you don't control the LLM's output format closely enough to guarantee clean JSON, or you're working with plain text that was never meant to be structured data in the first place (a document, a transcript) and you just need it chopped into pieces.
How to install it
Search comfyui_LLM_party in ComfyUI Manager and install, then restart. Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/heshengtao/comfyui_LLM_party.git
Run pip install -r requirements.txt from inside the pack's folder using ComfyUI's own Python, then restart. This node is plain string splitting with no dependencies of its own - the heavier install requirements in this pack (LLM clients, embeddings, OCR, TTS) belong to its other nodes sharing the same combined requirements.txt.
Common issues & troubleshooting
Everything ends up as one single item instead of several. Your sep doesn't actually match what's in the text - check the raw text for the exact character sequence being used as a break (a double newline instead of single, a different bullet marker) rather than assuming the default separator fits every source.
Empty items show up in the output. Consecutive separators with nothing between them (two newlines in a row, a trailing separator at the end of the text) produce empty entries in the split. If your downstream node chokes on blank items, that's worth filtering before or after this step rather than assuming this node is malfunctioning.
You wanted key-value pairs, not a flat list. This node only splits on a delimiter - it doesn't infer structure beyond that. For anything richer (parsing key: value lines into an object, for instance), you'd need a different node or a cleanup pass on json_data afterward.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| sep | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json_data | STRING | — |