JSON Builder Medium
Five clean key-value pairs without the quote drama
- json_string
The workhorse of the JSON Builder family
JSON Builder Medium builds a JSON object from up to five key-value pairs. It's the middle child of ComfyUI-LLMs-Toolkit's Simple/Medium/Large trio, and in practice it's the one most workflows actually need: a handful of structured fields - say subject, style, lighting, camera, negative - destined for a String Template that turns them into a prompt, or a JSON Combine that merges them with other blocks. Five pairs is enough for real structure without the sprawling node that the Large variant becomes.
It does exactly one thing and does it cleanly. The keys are typed in (fields key_1 through key_5, all required inputs with empty defaults), the values (value_1 through value_5) can be typed or wired in from other nodes, and out the other side comes one pretty-printed JSON string. No schema, no validation beyond "is this empty" - it's a formatter, and that's its virtue.
The bit that's easy to miss
Values are parsed as JSON before being written. Type 5 and the output contains the number 5; type true, null, or a nested {"x": 1} and they're preserved as native JSON types. That's what makes the output genuinely usable downstream - an LLM API or another JSON node sees real structure, not quoted strings. It also means you can construct nested objects by connecting another builder's output into a value slot.
Inputs and output
- key_1 … key_5 (required) - property names; blank keys are skipped.
- value_1 … value_5 (optional) - matching values, JSON-parsed, connectable.
- Output: json_string -
{"a": 1, "b": "two", ...}, indented two spaces.
Installing
It's one of twelve nodes in the HuangYuChuh/ComfyUI-LLMs-Toolkit pack - install the pack once. ComfyUI Manager → search ComfyUI-LLMs-Toolkit → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/HuangYuChuh/ComfyUI-LLMs-Toolkit
cd ComfyUI-LLMs-Toolkit
pip install -r requirements.txt
You'll find it under 🚦ComfyUI_LLMs_Toolkit/JSON. The pack's only dependencies are Pillow and aiohttp.
Gotchas
Mostly the same rules as its Simple sibling: empty keys or values are dropped silently (you won't get empty strings in the output), and values that fail JSON parsing fall back to plain strings. One real annoyance: if you only need two pairs, you still have to look at five key boxes - they're required inputs, so ComfyUI shows them all. That's fine, just leave the extras blank and they contribute nothing. If five isn't enough, jump to JSON Builder Large (ten pairs) or build blocks with this and merge them with JSON Combine.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| key_1 | STRING | — | |
| key_2 | STRING | — | |
| key_3 | STRING | — | |
| key_4 | STRING | — | |
| key_5 | STRING | — | |
| value_1opt | STRING | — | |
| value_2opt | STRING | — | |
| value_3opt | STRING | — | |
| value_4opt | STRING | — | |
| value_5opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json_string | STRING | — |