Convert string to JSON
Turning typed text into a real JSON value
- ui_widget
- json
A handful of nodes in this pack - LF_StringTemplate's replacements field, LF_ImageListFromJSON's json_input, LF_SaveJSON's json_data - expect an actual JSON-typed connection, not a plain string. If you're building that data by hand or pasting it in as text, you need a bridge between "text I typed" and "JSON ComfyUI recognizes as JSON." That's the entire job of LF_StringToJSON: parse a stringified JSON blob into the pack's native JSON type.
There's exactly one input, string, defaulting to {} - an empty object - so the node doesn't error out if you haven't typed anything yet. Type or paste your JSON into it, and the single output, json, is the parsed result, ready to plug into any JSON-typed input elsewhere in this pack. It's flagged as an output node, so it also surfaces its result directly in the UI, letting you sanity-check what you typed parsed the way you expected before it goes anywhere else.
It's a small node, deliberately - there's no schema validation, no key filtering, no transformation of any kind. It parses text into JSON and stops. That's actually the point: it's meant to be the one narrow bridge between the plain-text nodes in this pack (LF_StringTemplate, LF_RegexReplace, anything producing a STRING) and the JSON-typed ones, rather than trying to be a JSON editor in its own right. If you need to build JSON programmatically rather than typing it by hand, you're better off assembling it upstream and only reaching for this node when you genuinely have a string that needs to become structured data.
Installing it. ComfyUI Manager: search "LF Nodes," install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/lucafoscili/lf-nodes, then restart ComfyUI. Use that repo, not comfyui-lf - the one linked from comfy.icu is the pack's archived original home; active development is at lf-nodes now. No models, no dependencies beyond the pack itself.
Where people get tripped up. The most common failure is invalid JSON syntax that looks fine to a human but isn't - single quotes instead of double quotes around keys and strings, a trailing comma after the last item, or an unquoted key. JSON is stricter than a Python dict literal even though they look almost identical, and copy-pasting from Python code is the usual way this bites people. If the parse fails, check those three things first before assuming the node is broken. Second, remember this only parses - it doesn't validate against any particular structure another node expects, so if LF_ImageListFromJSON or LF_StringTemplate downstream is unhappy, the JSON parsed fine here but doesn't have the shape (the right keys, the right nesting) that node actually wants.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | {} | Stringified JSON |
| ui_widgetopt | KUL_CODE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json | JSON | — |