Nodes/ComfyUI-Light-Tool/Light-Tool: Deserialize a JSON string
ComfyUI Node

Light-Tool: Deserialize a JSON string

Turn a JSON string into a real object your graph can use

By ihmily·Created 2 years ago·Updated 4 months ago· 20
Light-Tool: Deserialize a JSON string
    • json_object
    json_str{"key": "This is value"}

    Light-Tool: DeserializeJsonString parses a JSON string into an actual JSON object. It's the front half of working with structured data in ComfyUI - APIs hand you JSON as text, files store it as text, and until you parse it, it's just an inert string you can't reach inside. This node makes it a live object that other nodes can pull values from.

    The display name says "Deserialize a JSON string," and that's the honest scope. Feed it a valid JSON document, get back a Python dict/list you can pipe into a value-extraction node (like the pack's KeyValue, which reads values by key path), a display node to inspect it, or anything else that accepts wildcard data.

    How it works

    It's a thin wrapper around Python's json.loads. The single input, json_str (multiline, with a sensible default of {"key": "This is value"}), is parsed and returned as json_object.

    The error handling is worth knowing about: invalid JSON doesn't crash the run - it returns an empty object {} instead. That's friendly in the sense that your workflow won't die on a malformed payload, but it's also a silent failure. A typo in your JSON, a missing quote, a trailing comma, and the node quietly hands you {} while you sit there wondering why every value extraction downstream comes up empty. When you're debugging, paste the string into a JSON validator first, because the node will not tell you it failed.

    Inputs and output

    • json_str - the multiline JSON text, defaulting to a working example.
    • json_object - the parsed result (wildcard type).

    That's the whole node - one input, one output, no configuration.

    Where it fits

    The realistic use cases all involve data coming from outside your graph:

    • API responses. A Load Image From URL or an HTTP call returns JSON metadata; parse it here, then extract the fields you need.
    • Shared config. A JSON blob as workflow metadata or a config file that drives a batch.
    • Metadata round-trips. The pack's own Load Metadata From URL reads embedded JSON from a downloaded image - deserialize it here and you can actually use those fields.

    Pair it with a key-path extraction node and you've got a minimal but workable "parse and pull values" data pipeline without installing a heavyweight JSON toolkit. For heavy validation or complex schemas, a dedicated JSON pack is the better call; for "I have a JSON string and I need it to be an object," this is exactly enough.

    Install

    Standard: ComfyUI Manager → search ComfyUI-Light-Tool, or clone into custom_nodes, pip install -r requirements.txt, restart. It's under ComfyUI-Light-Tool → DataProcessing. Pure standard library - no dependencies beyond Python's built-in JSON module.

    CategoryComfyUI-Light-Tool/DataProcessing

    Inputs (1)

    NameTypeDefaultDescription
    json_strSTRING{"key": "This is value"}

    Outputs (1)

    NameTypeDescription
    json_object*