Nodes/Fal-Gateway/JSON Extract (Single)
ComfyUI Node

JSON Extract (Single)

Pull one field out of any JSON string, safely

By modbender·Created 5 months ago·Updated 3 months ago· 1
JSON Extract (Single)
    • value
    json_string
    key
    default

    JSON Extract (Single) is the small, boring node that makes the pack's clever one actually usable. When you fill the schema widget on Fal Text-to-Text or Fal Image-to-Text, the model returns a JSON object as a STRING. This node takes that string, pulls out one key, and hands you the value as a plain STRING you can wire anywhere.

    It's a one-job utility: (json_string, key, default) → value. Nothing clever, no fal dependency - it works with any JSON STRING from any node that produces one, which makes it far more useful than "companion to the LLM nodes" suggests.

    Inputs and outputs

    • json_string - the JSON text. Multiline, and it's forceInput, meaning you wire it from an upstream node rather than typing it. That's deliberate: your LLM output arrives as a socket, not a widget.
    • key - the field name to pull. If you want title out of {"title": "Sunset", "tags": "x"} you type title.
    • default - optional. What you get back when the key is missing or the string doesn't parse. This is the circuit-breaker the README tells you to set, because models don't always honor a schema.

    One output: value (STRING). Missing key, unparseable input, or non-dict JSON all fall through to default - you never get a node that hard-crashes the graph on bad input. Nested objects and arrays are serialized back as JSON, primitives are stringified.

    When you'd reach for it

    The pattern that made it: schema mode on the T2T node gives you one Claude call returning flux_ref_prompt, title, tags as JSON, and you drop one of these per field, each with its own default. That per-field default is the whole reason the single version still exists - when keys come from different upstream JSON sources, or you want a fallback per output rather than one shared default, the single node is cleaner than the multiple version.

    Install

    Part of ComfyUI-Fal-Gateway, so it installs with the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/modbender/ComfyUI-Fal-Gateway
    pip install -r requirements.txt
    

    No API key needed for this one - it's pure local string parsing, which the README calls out explicitly. You'll still want the key for the LLM nodes upstream of it. Restart ComfyUI and it's under Fal-Gateway.

    Gotchas

    • Forget the default and you'll chase ghosts. When a smaller model ignores response_format and returns prose, this node faithfully returns whatever you set as default. Empty default means empty output and a confusing graph. Set one.
    • It's single-key by design. If you're fanning out five fields from one JSON object, JSON Extract (Multiple) does it in one node with per-row outputs; this one is for the occasional field or mixed sources.

    That's it. It's a tiny node, but it's the difference between "the LLM returned JSON I can't use" and a workflow where the model's structured output flows straight into your prompts and filenames.

    CategoryFal-Gateway

    Inputs (3)

    NameTypeDefaultDescription
    json_stringSTRING
    keySTRING
    defaultoptSTRING

    Outputs (1)

    NameTypeDescription
    valueSTRING