JSON Root Object
The output node that validates your payload before anything else sees it
- objects
- JSON_TEXT
Every JSON-building workflow in comfyui-json-nodes ends the same way: at JSON Root Object. It's the pack's output node, and it does three things in one place - merges all your field and object fragments into a single payload, validates that payload against an optional JSON Schema, and shows you a live preview right in the node so you can see what you're about to send. If you're assembling JSON for an API call, this is the last stop before the wire.
How it works
Like the pack's merge node, it takes autogrow object inputs (json_input_1, json_input_2, …) and deep-merges them in socket order. It's built to sit at the end of the chain: connect JSON Field outputs here, connect merged objects here, connect whatever produces JSON. The merge is the same machinery as JSON Object Merge, including the duplicate_key_policy combo (error / overwrite / keep_first, default error) - but error messages here are friendlier, labelling sources as field 1 and field 2 instead of just object numbers.
The validation is the part that's unique in the pack. Give schema_json a JSON Schema-like object and the node checks the merged result against it before it returns anything. It supports type, required, properties, enum, pattern, and items. If the schema's top-level type is omitted it's assumed to be object, and supported types are any, string, int, float, boolean, array, and object. Flip on strict_mode and keys not declared in properties get rejected outright - the strictness applies to nested objects too.
Inputs and output
objects- autogrow JSON object inputs (min 1, up to 64).preview_json- an internal read-only channel the frontend uses; execution ignores its value. Leave it alone.duplicate_key_policy-error/overwrite/keep_first.schema_json- optional JSON Schema; must be a valid JSON object.strict_mode- reject undeclared keys (default off).pretty_print- on by default.
Output is JSON_TEXT, a STRING with the validated, merged object.
The frontend tricks that make it usable
This pack ships a real frontend, not just backend nodes. Root has a Create Schema button that infers a schema from your current preview - it walks the object and assigns int, float, boolean, string, object, array, and any types, turning mixed or empty arrays into items: {"type": "any"}. So you can build your payload, click the button, and get a starting schema you then tighten by hand. The preview itself updates as you run, and root inputs get relabelled from their source field keys so you can tell camera from subjects at a glance. It's the rare case where a JSON node's UI actually makes you faster.
Installing it
It ships with the rest of the pack - one install, five nodes. ComfyUI Manager, search comfyui-json-nodes:
cd <ComfyUI>/custom_nodes
git clone https://github.com/olliethomas1992/comfyui-json-nodes
Restart ComfyUI and it's under utils/json. No extra dependencies or model downloads; the pack's requirements.txt is empty.
Common issues
Most failures are schema mistakes, and the node is good about naming them: missing required fields, type mismatches ("expected int, got str"), unexpected keys in strict mode, invalid schema JSON, and duplicate-key conflicts all come back as human-readable messages instead of a traceback. The trap is forgetting which policy you set - with error (the default) two fields setting the same key will fail the run, which is usually what you want, but can look like a bug if you meant to override. And remember the settings in ComfyUI Settings → JSON Nodes (default strict mode, default duplicate key policy) only apply to nodes you create after changing them; saved workflows keep their own values.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| objects | COMFY_AUTOGROW_V3 | — | |
| preview_json | STRING | {} | — |
| duplicate_key_policy | COMBO | error | What to do when multiple field inputs share the same key: error (reject), overwrite (last wins), or keep_first. |
| strict_mode | BOOLEAN | false | When enabled, keys not declared in the schema are rejected. |
| pretty_print | BOOLEAN | true | — |
| schema_jsonopt | STRING | Optional JSON Schema. Supports type, required, properties, enum, pattern. Use 'Create Schema' button to auto-generate from preview. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| JSON_TEXT | STRING | — |