JSON Builder Simple
One key-value pair, properly quoted
- json_string
The smallest JSON builder you'll ever see
LLMs love structured input, and ComfyUI text nodes are just strings. JSON Builder Simple is the pack's answer to "I need a tiny bit of structured data on this wire" - one key and one value, assembled into a proper JSON object. It's the S in the pack's Simple/Medium/Large trio, and its whole job is to save you from hand-typing {"key": "value"} with the right quotes, escaping, and trailing-brace discipline that beginners always botch.
Is it overkill for one key-value pair? Honestly, sometimes. You could type {"name": "Alice"} directly into a text node. Where it earns its keep is (a) when that value comes from another node's output - the value input accepts a connection, so the JSON gets rebuilt live every run - and (b) when you're feeding a downstream String Template or JSON Combine that expects properly-formed JSON and you don't want to think about quoting.
How it works
You give it a key and a value, and it returns a json_string. The detail worth knowing: the value is run through json.loads first, so if you type 42, true, null, or even a nested object, they're stored as native JSON types - not quoted strings. Type {"x": 1} as the value and you get a nested object; type hello and it's a string. That's usually what you want, and it's the difference between this node and a dumb text concatenator.
Inputs and output
- key (required, default "key") - the property name. Blank keys get dropped.
- value (optional) - whatever goes with it. Leave empty and the pair is omitted.
- Output: json_string - e.g.
{"name": "Alice"}, pretty-printed with two-space indent.
Installing
Ships with HuangYuChuh/ComfyUI-LLMs-Toolkit, so one install covers it. ComfyUI Manager → search ComfyUI-LLMs-Toolkit → Install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/HuangYuChuh/ComfyUI-LLMs-Toolkit
cd ComfyUI-LLMs-Toolkit
pip install -r requirements.txt
Restart, then it's under 🚦ComfyUI_LLMs_Toolkit/JSON. Dependencies are just Pillow and aiohttp.
Gotchas
The one that trips people: empty key or empty value means the pair silently vanishes - you won't get {"": ""}, you'll get {}. If your output is unexpectedly an empty object, that's why. And because values are JSON-parsed, leading/trailing spaces or a stray comma in a typed value can make json.loads fail, in which case the raw string is used as-is - which is fine, but can surprise you when 1.5 stays a number and 01.5 becomes a string. Use the Medium or Large variant when you need more than a single pair.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | key | — |
| valueopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json_string | STRING | — |