Nodes/LF Nodes/Write JSON
ComfyUI Node

Write JSON

A JSON text box that catches your typos before the queue does

By lucafoscili·Created 2 years ago·Updated 2 years ago· 50
Write JSON
  • ui_widget
  • JSON

There are two ways to get JSON into a ComfyUI workflow: paste it somewhere, or type it. WriteJSON is the LF Nodes answer to the second one, and the reason people keep it around is the validation. As you type, it reformats your JSON every 2.5 seconds, and if you've broken the syntax it tells you - the error shows up in the textarea's title, so you catch it on hover before you ever hit queue.

That's genuinely the whole product, and it's a small but real quality-of-life win. Any Comfy user who's fed malformed JSON into a node and watched the queue fail knows the pain this removes. WriteJSON is an output node with one input - the ui_widget textarea - and one output: a JSON object. Wire that into any node that accepts JSON: GetValueFromJSON, GetRandomKeyFromJSON, SetValueInJSON, a SwitchJSON for A/B testing, or UpdateUsageStatistics if you're hand-crafting a dataset.

Mechanically it's almost nothing: the frontend widget collects the text, validates and pretty-prints it live, and on execution the node parses it into a dict and passes it down the wire. The value of the node is the UI, not the Python - which is a running theme across LF Nodes, whose widgets are all built on the Ketchup Lite web components library.

What you set:

  • ui_widget - the textarea; type valid JSON here. Defaults to {}.

A few honest notes. First, this node is deliberately dumb - it doesn't merge, transform, or query anything. If you need to modify an existing dataset, pair it with SetValueInJSON or a StringToJSON for building JSON from string inputs. Second, remember LF's JSON is often "Ketchup Lite-compatible" data with a nodes array - write plain JSON for generic consumers, but if you're feeding a widget-rendering node, that's the structure it wants.

Installing LF Nodes (shared across the whole pack):

  • ComfyUI Manager → search "LF Nodes" → install → restart, or
  • cd ComfyUI/custom_nodes && git clone https://github.com/lucafoscili/comfyui-lf then restart.

The repo is in legacy mode - frozen at its last release while development moved to lucafoscili/lf-nodes - but everything still works and this node carries over unchanged. It downloads no models and needs no special dependencies beyond the pack's standard ones. The one thing that trips people up: if you paste in invalid JSON, the node doesn't hard-fail on queue - the error is tucked into the title bar, so glance at it before rerunning or you'll debug a silent mismatch downstream.

Category✨ LF Nodes/JSON

Inputs (1)

NameTypeDefaultDescription
ui_widgetKUL_TEXTAREA{}Write your JSON content here.

Outputs (1)

NameTypeDescription
JSONJSON