Nodes/ComfyAngel/JSON Extract 🪽
ComfyUI Node

JSON Extract 🪽

Pull values out of JSON without writing code

By ThepExcel·Created 8 months ago·Updated about a month ago· 14
JSON Extract 🪽
    • values
    • values_joined
    • count
    json_string
    fields
    delimiternewline
    output_delimiternewline
    default_value

    ComfyUI is full of JSON - workflow files, API responses, embedded metadata - and most of the time you just want one number out of it. JSON Extract 🪽 is the node that gets it. You paste JSON in, list the fields you want with a simple path syntax, and it hands back the extracted values as a list plus a joined string. It's the pack's answer to "I have a JSON blob and I need the seed."

    The inputs

    • json_string - the JSON text.
    • fields - one field path per line (or per delimiter). This is the whole language, and it's tiny:
      • seed → the top-level seed
      • 3.inputs.stepsjson["3"]["inputs"]["steps"]
      • nodes[0].typejson["nodes"][0]["type"]
      • data.users[0].name → nested objects and array indices mixed, with bracket chains like [0][1] supported.
    • delimiter / output_delimiter - newline, comma, pipe, or semicolon. The first decides how your fields list is split; the second how the extracted values are joined back together.
    • default_value - what to emit when a field doesn't exist (empty string by default).

    There's also a Browse JSON Fields button that opens a visual tree viewer of the JSON, so you can see what's actually in the blob instead of guessing paths blind - genuinely helpful given ComfyUI's nested inputs structure.

    The outputs

    • values - a list of the extracted values as strings.
    • values_joined - the same values joined with your output_delimiter. The convenience output you'll grab when you just want "the seed, the steps, the cfg" as one string.
    • count - how many fields were extracted.

    The mechanism is a small recursive walker: it parses your path into keys and indices, walks the JSON, and stringifies whatever it finds - booleans become true/false, nested dicts/lists become compact JSON. Missing keys and bad indices return the default_value instead of crashing.

    Where it shines

    Pair it with ComfyUI's embedded workflow JSON - load an image with Load Image + Metadata and pull 3.inputs.seed out of the prompt metadata. Or hook it to any API node that returns JSON and extract the field you care about. It's also an honest debugging tool: paste a workflow file and see the actual values, which is faster than reading JSON by eye.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/ThepExcel/ComfyAngel.git
    

    Restart ComfyUI, or search "ComfyAngel" in ComfyUI Manager. Pillow is the only dependency; no models.

    Two failure modes to know: invalid JSON returns a single JSON Error: <detail> value (the error text lands in values), and there's no such thing as a nested-path typo being forgiven - a wrong key quietly yields default_value. When in doubt, Browse JSON Fields first.

    CategoryComfyAngel/Utility

    Inputs (5)

    NameTypeDefaultDescription
    json_stringSTRING
    fieldsSTRING
    delimiteroptCOMBOnewline4 options: newline, comma, pipe, semicolon
    output_delimiteroptCOMBOnewline4 options: newline, comma, pipe, semicolon
    default_valueoptSTRING

    Outputs (3)

    NameTypeDescription
    valuesSTRING
    values_joinedSTRING
    countINT