JSON Parse
Split your LLM's JSON into strings without writing a line of code
- out1
- out2
- out3
- out4
- out5
- out6
- out7
- out8
- obj
The moment your LLM starts returning structured output, you need a way to crack the JSON open in the graph. JSON Parse is that tool: it takes a JSON string - the kind a Chat node hands back when you ask for structured output - and extracts up to eight values by dot/bracket paths, each on its own output port. No Python, no scripting node, just a path string per port.
How it works
You give it json_text plus up to eight path fields. Paths are the familiar dot/bracket syntax: positive, params.width, items[0].name, items[0]["name"]. It walks the parsed object and lands each value on the matching out1–out8 port as a STRING (numbers and booleans get stringified, nested objects come back as JSON text). There's also a obj output that carries the whole parsed object on the pack's SIMPLECHAT_JSON type, for chaining into other SimpleChat nodes.
Three niceties baked in:
- Code fences auto-stripped -
strip_code_fencedefaults on, so a reply wrapped in```json ... ```still parses. LLMs love wrapping their JSON; this saves you a cleanup step. - A default value - the
defaultinput (default"") is what a port gets when a path isn't found. Keeps missing keys from erroring the whole graph. - Strict-ish parsing - it's a straightforward
json.loadswith fence-stripping, so well-formed output is fine and malformed output errors loudly (unlike the forgiving parsers inPrompt JSON Unpack).
Why it beats manual copy-paste
Because it runs live. In the flagship loop, Chat → JSON reply → this node → eight string ports wired into your sampler's prompt and parameter slots. Ask the LLM for {"positive": ..., "negative": ..., "seed": ...} and re-run with a different request to iterate without ever touching the node. It's the manual version of Prompt JSON Unpack - which is exactly the trade: this one takes any schema via paths, the other is fixed-schema but gives you typed INT/FLOAT/SAMPLER outputs. If your JSON matches the Anima prompt schema, use Prompt JSON Unpack and skip the path typing; if your schema is your own, this is the one.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/Moeblack/ComfyUI-SimpleChat
Restart, or use Manager and search "ComfyUI-SimpleChat". Only dependency: aiohttp.
Gotchas
Eight ports is a hard ceiling - for sixteen, use the pack's JSON Parse (16) variant. Values come out as strings, so if you wire out3 (a number) into an INT input you'll need Prompt JSON Unpack-style casting or a convert node; this node won't do it. And remember it needs a string of JSON - if your upstream hands you the already-parsed SIMPLECHAT_JSON object, you want JSON -> Vars or a direct obj consumer instead.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| json_text | STRING | — | |
| strip_code_fence | BOOLEAN | true | — |
| default | STRING | — | |
| path1 | STRING | — | |
| path2 | STRING | — | |
| path3 | STRING | — | |
| path4 | STRING | — | |
| path5 | STRING | — | |
| path6 | STRING | — | |
| path7 | STRING | — | |
| path8 | STRING | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| out1 | STRING | — |
| out2 | STRING | — |
| out3 | STRING | — |
| out4 | STRING | — |
| out5 | STRING | — |
| out6 | STRING | — |
| out7 | STRING | — |
| out8 | STRING | — |
| obj | SIMPLECHAT_JSON | — |