Nodes/Enhancement Utils/Parse JSON (EnhUtils)
ComfyUI Node

Parse JSON (EnhUtils)

Turning ComfyUI's JSON strings into objects a node can actually use

By phazei·Created 7 months ago·Updated 4 days ago· 41
Parse JSON (EnhUtils)
  • values
  • data
  • json_string
◄lenienttrue►
◄path►

Here's a ComfyUI annoyance that catches everyone eventually: a node hands you a JSON string, and the node you want to feed it to won't accept anything but real data types. Parse JSON (EnhUtils) is the tiny bridge between those two worlds - it takes a JSON string and parses it into an actual Python object (dict, list, number, whatever) on an any-type output. That's the whole node, and it's exactly as useful as it sounds.

It's shipped inside phazei/ComfyUI-Enhancement-Utils, and its intended partner is that same pack's Load Image (With Subfolders). That loader outputs metadata and imagedata as JSON strings - human-readable, but useless to a node that wants a dict. Wire those strings into Parse JSON and suddenly you can pull the embedded generation prompt or the image dimensions out as structured data, the way you'd index into any object.

How it works

The mechanism is one line of Python: json.loads(). It's a faithful, no-frills wrapper - nothing cached, nothing async. The one interesting design choice is that json_string is a forced input: you can't type into it, you have to wire a string output into it. That's deliberate - it keeps the node from silently holding stale text and makes the data flow explicit in the graph.

The single input, json_string, takes a string containing valid JSON. The single output, data, is typed * (any), so it can connect to nodes that accept arbitrary inputs. That's also where it pairs so well with scripting nodes like rgthree's Power Puter, which evaluates Python-like expressions mid-graph and is exactly the kind of thing that wants real objects, not text. metadata.prompt or imagedata.width becomes a one-step lookup instead of a regex job.

How to install it

No model files, no heavy deps - this is part of the Enhancement Utils pack. In ComfyUI Manager, search "Enhancement Utils". Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/phazei/ComfyUI-Enhancement-Utils.git
cd ComfyUI-Enhancement-Utils
pip install -r requirements.txt

Restart ComfyUI and look under the utils category.

Where people get tripped up

  • Invalid JSON raises an error - and that's the feature. If you feed it a string that isn't valid JSON, execution stops with [Parse JSON] Invalid JSON: ... so you know exactly what broke, rather than passing garbage downstream.
  • Not every node accepts the * output. ComfyUI lets the wildcard type connect to almost anything, but a few nodes are picky about concrete types. If a wire won't land, the problem is the target node's input typing, not the parse.
  • The embedded prompt/workflow values are themselves JSON. In Load Image (With Subfolders) v1.3.0+, the prompt lives inside the metadata JSON rather than on its own output - parse the whole metadata string, then index into prompt or workflow as nested dicts. If an image was stripped of its chunks, you get {} and the parse is empty, which is correct behavior, not a bug.
Categoryutils

Inputs (3)

NameTypeDefaultDescription
valuesoptCOMFY_AUTOGROW_V3JSON strings to parse and combine.
lenientoptBOOLEANtrueRecover JSON from LLM-style output: strips markdown code fences and surrounding text, removes trailing commas, and accepts Python-style dicts (single quotes, True/None).
pathoptSTRINGOptional path to a nested value, e.g. 'workflow.nodes.0.type' or 'items[2].name'. Leave empty to output the whole result.

Outputs (2)

NameTypeDescription
data*The parsed (and combined) Python object.
json_stringSTRINGThe result re-serialized as formatted JSON.