Create Json
Build a JSON string one key at a time
- value
- json_str
A small structuring node: give it a key and a value, and it emits a JSON string carrying that pair. On its own that's not much, but Mixlab is built around a bigger idea - publishing a workflow as a web app or calling it as an API - and a structured JSON result is a lot easier for whatever's on the other end of that call to consume than a scatter of separate string and number outputs. This node is how you assemble that structure without leaving the graph.
How it works
You feed it a key, a value (any type - string, number, whatever), and whether to save it. Optionally, you can also feed in an existing json_str - the output of a previous CreateJsonNode - so you can chain several of these together, each one adding its own key, and build up a multi-field JSON object across the chain rather than overwriting a single field. Because it's also marked as an output node, it renders visibly in the ComfyUI UI as well as producing the string.
The inputs and outputs that matter
key(STRING, defaultdata, required) - the field name for this value.value(accepts any type, required) - what goes under that key.save(BOOLEAN, defaulttrue, required) - whether this gets persisted, not just displayed.json_str(STRING, optional) - an existing JSON string to build onto, for chaining multiple keys together.
The single output is json_str (STRING) - the resulting JSON, ready to feed into another CreateJsonNode, into a save/text node, or out to whatever's consuming your workflow's output.
How to install it
Ships with the Mixlab pack.
- ComfyUI Manager: search
comfyui-mixlab-nodes, install, restart. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/shadowcz007/comfyui-mixlab-nodes.git, install requirements (install.baton Windows, or../../../python_embeded/python.exe -s -m pip install -r requirements.txt), restart.
No model downloads - this is a pure data utility.
Common issues & troubleshooting
Building up multiple keys and only the last one shows. Make sure you're actually passing the running json_str forward into the next CreateJsonNode's json_str input - leave that input empty and you're presumably starting a fresh object each time instead of merging into the previous one.
Wired an IMAGE into value and got garbage. The value field accepts any type, but that doesn't mean it serializes sensibly - this node is meant for simple values (strings, numbers, small structures), not raw image tensors. If you need to reference an image, pass its filename or a saved path as a string instead of the image data itself.
Downstream node doesn't understand the output. Remember json_str is a serialized string, not a live object - anything consuming it needs to parse it as JSON on its end, whether that's another node in the graph or an external caller reading your workflow's API response.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | data | — |
| value | * | — | |
| save | BOOLEAN | true | — |
| json_stropt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json_str | STRING | — |