JSON Chain Raw Pair (Soze)
Embed a JSON string as a real value — the bridge node
- chain_in
- chain_out
Sometimes the JSON you want to embed already exists as text. You've extracted a nested object out of a file with a parser, or you have a JSON blob sitting in a string, and you want it in your payload as a real object - not as a string that happens to contain braces. JSON Chain Raw Pair (Soze) is the pair node that parses a JSON string and embeds the result as-is. It's the bridge between "JSON as text" and "JSON as structure."
Where it shines is carrying extracted data into a new chain. The source notes the specific workflow: use JSON Value Parser to pull a nested object (like a Story block) out of one JSON file, then re-attach it under any property name in a fresh chain you're building. The parser output is a JSON-encoded string; this node turns it back into a value and drops it into place.
How it works
The json_string input is parsed with json.loads - it accepts a plain JSON string, and also tolerates json ``` fenced blocks (handy if your text came from an LLM). The parsed result can be an object, an array, or a scalar, and it's embedded exactly as parsed under your name. The strict toggle is the interesting one: with strict off, a failed JSON parse falls back to Python's ast.literal_eval, which accepts single-quoted dicts and lists - the shape you get from Python-style logging or some sloppier tools. Strict on (the default) raises on anything that isn't valid JSON.
Inputs and outputs
- name - required string widget, the key.
- json_string - required STRING input (forced), the JSON text to embed.
- strict - optional BOOLEAN, default true. False enables the Python-literal fallback.
- chain_in - optional
JSON_PAIRS; the previous pair'schain_out.
Output: chain_out. Example:
Raw Pair("story", "{\"title\":\"Quest\",\"acts\":3}") → JSON Generate
→ {"story":{"title":"Quest","acts":3}}. Note the nested object - not a quoted string.
Installing it
Part of the Soze pack:
cd ComfyUI/custom_nodes
git clone https://github.com/SozeInc/ComfyUI_Soze.git
pip install -r ComfyUI_Soze/requirements.txt
Restart ComfyUI, or search ComfyUI_Soze in ComfyUI Manager.
Gotchas
Invalid JSON with strict on will throw and fail your run - that's by design, but it means garbage in produces a hard error, not a silently mangled payload. If you're feeding it untrusted or sloppy text, flip strict off so the Python-literal fallback has a chance, though that accepts a narrower set of formats. And watch the quoting when you type JSON by hand into this node: in a widget, {"a":1} works, but if you're copying a string with single quotes and strict is on, it'll fail - that's exactly the case where strict=false rescues you.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| name | STRING | — | |
| json_string | STRING | JSON to embed. Object, array, or scalar. | |
| strictopt | BOOLEAN | true | If False, falls back to ast.literal_eval for Python-style dicts/lists. |
| chain_inopt | JSON_PAIRS | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| chain_out | JSON_PAIRS | — |