JSON Field
Build a typed JSON payload one dot-path at a time
- FIELD_JSON
ComfyUI is brilliant at moving images around a graph, but the second your workflow ends in an API call - a webhook, an LLM endpoint, a settings payload - you need real JSON, and stock ComfyUI gives you almost nothing that builds it. JSON Field is the workhorse of the comfyui-json-nodes pack for exactly that moment.
The premise is one node, one typed field. You give it a key and a value, it hands you a JSON object fragment like {"camera": {"lens-mm": 85}}, and you feed that fragment into the pack's JSON Object Merge or JSON Root Object to assemble a whole payload. Where it earns its keep is nesting: the key input is a dot-separated path, so camera.lens builds a nested object, subjects[0].name writes into an array, and hyphenated keys like lens-mm work fine - which matters because half the APIs you'll hit want them.
The inputs that matter
key- the dot path.camera.lens,subjects[0].name,lens-mm. This is what gives you nesting for free.type- a combo:string,int,float,boolean,array,object. This decides how your value text gets interpreted.array_separator-newlineorcomma, used only whentypeisarray. The UI hides it otherwise.value- the multiline text box you actually type into.
The single output is FIELD_JSON, a STRING containing the JSON fragment. It wires into JSON Object Merge or JSON Root Object (both in this pack); treat it as a building block, not a final result.
How the typing works
The coercion rules are worth knowing before they bite you. For int, the value must be a whole number - feed it 85.0 and it errors. For float, NaN and Infinity are rejected outright. boolean treats 1, true, yes, and on as true and everything else as false, which is friendlier than most JSON tooling bothers to be. array accepts real JSON array syntax directly, or splits plain text by your separator with best-effort coercion (so 12 becomes a number, true a boolean, null an actual null). object requires valid JSON - pass it anything else and you get a clear "must be valid JSON object" error.
Two behaviors that feel deliberate. First, sparse array paths get padded with null, so a key of subjects[2].description produces [null, null, {...}] rather than failing - handy if a downstream API wants fixed-length arrays. Second, an empty key raises "key is required" instead of silently producing garbage, and field errors come back as readable key/value messages rather than a raw traceback.
Installing it
Install the whole pack once; this node ships with four others from olliethomas1992/comfyui-json-nodes. The easy route is ComfyUI Manager - search for comfyui-json-nodes and install. Or, by hand:
cd <ComfyUI>/custom_nodes
git clone https://github.com/olliethomas1992/comfyui-json-nodes
Restart ComfyUI and the nodes appear under the utils/json category. No model downloads, and requirements.txt is explicitly empty - the pack leans on what ComfyUI already provides, so it's about as dependency-free as custom nodes get.
Where people get burned
Mostly it's the separator trap: type a comma-separated array while the separator is still newline and you'll get one array item that's a whole comma string. If you're building lots of arrays, set the default separator once in ComfyUI Settings → JSON Nodes → Default array separator - that setting only applies to newly created nodes, so existing workflows keep their saved values. And the classic one: leave type as string and your "number" comes out quoted. If you want a real number in the JSON, tell the node what it is.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | Dot-separated path (e.g. camera.lens). Supports array indexing (items[0]) and hyphens (lens-mm). | |
| type | COMBO | How to interpret the value. 'int' and 'float' coerce to numbers; 'array' splits by separator; 'object' parses as JSON. | |
| value | STRING | Value to assign. For arrays: one item per line (or JSON array syntax). For objects: valid JSON object. | |
| array_separatoropt | COMBO | newline | 2 options: newline, comma |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FIELD_JSON | STRING | — |