Nodes/ComfyUI_JSON_Helper/JSON String to Object
ComfyUI Node

JSON String to Object

The tiny glue node that fixes ComfyUI's JSON type mismatch

By a-und-b·Created 2 years ago·Updated 2 years ago· 5
JSON String to Object
    • JSON
    json_string

    This node's entire job is one line: take a JSON string, hand you a JSON object. It's the smallest kind of custom node there is - no model files, no Python dependencies beyond the standard library, no API calls, no keys. If you've ever stared at a workflow where a node says it wants a JSON input but the thing feeding it is plain text, this is the adapter you're missing.

    Why you'd reach for it

    ComfyUI wires are typed, but "JSON" isn't a built-in type. It's a loose convention a bunch of packs use for inputs that expect structured data: workflow-export nodes, LLM nodes that return structured output, API-helper nodes. The problem is that a node producing JSON-as-text usually outputs a STRING - and a STRING wire won't plug into a JSON socket cleanly. This node sits in between. It's the same bridging role the wider ecosystem solves with utility packs, just stripped to the absolute minimum: text in, parsed object out.

    How it works

    Under the hood there's one function calling Python's json.loads() on your input and returning the result. That's it. The parsing is strict JSON - the real thing, which means double quotes only, no trailing commas, no comments, no single-quoted keys. If you paste a Python dict, it will not parse. And when parsing fails, the node prints Error decoding JSON: ... to the console and returns None instead of raising. That graceful-failure behavior is the closest thing this pack has to a personality.

    The input and output that matter

    • json_string (STRING, multiline) - the only input. It's marked multiline, so you can type or paste JSON straight into the node's box rather than wiring text in from elsewhere.
    • JSON output - the parsed object, typed as JSON.

    That's the full schema. No optional knobs, no modes. Wire it after anything that emits JSON as text, and feed the output into whichever node declared a JSON input.

    Installing it

    Easiest route: ComfyUI Manager → "Install Custom Nodes" → search ComfyUI_JSON_Helper and hit install, then restart ComfyUI. The pack is registered with the Comfy Registry, so Manager finds it. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/a-und-b/ComfyUI_JSON_Helper
    # restart ComfyUI
    

    One trap: the README's own clone command says ComfyUI-JSONHelper (hyphenated), which doesn't match the actual repo name (ComfyUI_JSON_Helper, underscore). Copy-paste that and you'll clone nothing useful. Use the URL above, or just let Manager handle it. There are no models to download and no dependencies to fight - if ComfyUI runs, this runs.

    Common issues

    Nothing comes out but a NoneType error downstream. You fed it bad JSON. The node doesn't blow up; it silently returns None, and the failure surfaces as a confusing error in whatever node is next in line. Check your ComfyUI console - that's where the actual "Error decoding JSON" message goes, not the node's little red box. The classic culprits are single quotes and trailing commas; both are legal Python, neither is legal JSON.

    The wire won't connect at all. Remember the output type is JSON, a convention, not a universal socket. If the target node's input is declared as STRING or a pack-specific type, this node can't bridge it - you're in "find the right adapter" territory, and it's not this one. Type mismatch is the single most common reason this node shows up in a workflow at all, so it's worth knowing the convention is the constraint, not a bug in the node.

    It's not going to change your life, but when a downloaded workflow demands a JSON input and you're feeding it strings, this is the exact, dependency-free patch.

    Categorysd

    Inputs (1)

    NameTypeDefaultDescription
    json_stringSTRING

    Outputs (1)

    NameTypeDescription
    JSONJSON