XAV Create Empty JSON Object
The blank {} that starts a build-from-scratch JSON
- json_ref
Every workflow you've ever loaded is JSON under the hood, and so is the metadata baked into every ComfyUI PNG. But what if you want to build a JSON payload from scratch - a config, a manifest, an API request your workflow will hand to something else? You need a place to start, and that's this node: it gives you an empty container and says "go build."
The entire node is one boolean. is_array off (the default) creates an empty object {}; flip it on and you get an empty array []. That's the whole input surface. The single output is json_ref - a handle to the container that you feed into XAV Set JSON Value, XAV Set JSON Value From Ref, or XAV Save JSON to File. Note there's no JSON visible anywhere; json_ref is a reference, not the data.
That reference business is the thing to wrap your head around, and it applies to every node in this pack. ComfyUI wires are typed, and JSON has no native type, so the pack keeps every real object in a process-wide cache and passes a UUID key around the graph instead. It's fast - nothing gets serialized as the object travels - but it means you can't read the contents by looking at the node. To see what you've built, pipe it into XAV JSON to Primitives or save it to a file.
Where this fits in a real workflow: you pair it with the Set nodes to assemble a document step by step, then Save to File at the end. It's also the natural landing spot for structured output - say, a payload shape you'll later fill from LLM or API nodes elsewhere in the graph.
The one quirk worth knowing: the empty container is cached per node instance in that global cache, and ComfyUI never clears it. The node hands back the same cached container when it can rather than a fresh one, and there's no built-in reset. In practice, if a workflow re-executes the node or a previous run's object identity gets reused, your "empty" container can show up with last run's values still in it. If you ever suspect stale data, delete the node and drop in a new one, or restart ComfyUI - that wipes the whole cache and guarantees a clean slate. It's the price of the speed, and it's easy to miss.
Also, a tiny trap in the same code: if you create an object, then flip is_array to build an array in the same node, you get a new empty array - but flip back and the old object is still there, stale values and all. When in doubt, re-add the node.
Install is the easiest part of this pack. It's pure Python stdlib - zero dependencies, no pip install, no models to download. ComfyUI Manager → Install Custom Nodes → search "ComfyUI XAV JSON Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/XAV-Games/ComfyUI-XAVJsonNodes
Restart ComfyUI and every node in the pack shows up under Add Node → XAV/json. (The README's own clone command literally says your-username - that's a placeholder; use the real repo above.)
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| is_array | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json_ref | STRING | — |