ComfyUI Node

HTTP Get JSON Field

Turn an API's JSON soup into a string you can actually use

By wawahuy·Created about a year ago·Updated 11 months ago· 14
HTTP Get JSON Field
    • value
    • formatted_value
    • count
    json_data{}
    field_path$.data
    extraction_methodjsonpath
    default_value
    return_typeauto
    multiple_resultsfalse

    The annoying part of calling an API from ComfyUI was never the call - it's that the response is a giant JSON blob and you wanted one field out of it. That's this node's entire reason to exist. It sits right after an HTTP request node, takes the json (or content) output, and pulls out the value you care about: the image URL, the caption, the number of credits left, whatever.

    HTTP Get JSON Field is the node that makes the "GET → extract → use" pipeline actually feel good, and it's the one you'll reach for constantly once you start building workflows that talk to APIs.

    How it works

    Three required inputs:

    • json_data - the JSON text to search. Feed it the json output from any HTTP method node.
    • field_path - where to look.
    • extraction_method - how to interpret that path. Default jsonpath is the power tool; simple and nested are fallbacks.

    For the jsonpath method, this node uses the jsonpath-ng library, so the path syntax is the real deal:

    • $.data.image_url - dive into nested objects.
    • $.data.users[0].name - first element of an array.
    • $.users[*].email - every email in the list.

    That [*] wildcard is where the optional inputs come in. multiple_results (default off) turns "return the first match" into "return all matches as a JSON array." return_type (string / json / auto) controls whether a result that's itself an object comes back as a formatted string or raw JSON. default_value is what you get when nothing matches - pair it with the count output to detect "this field wasn't there."

    Three outputs: value (the extracted thing, as a string), formatted_value (pretty-printed), and count (how many matches - 0 means the path didn't hit).

    The dependency catch

    jsonpath-ng is the one genuinely new Python package this pack installs. If it's missing, the node falls back to simple extraction and prints a warning - basic dotted paths still work, but [*] and recursive $.. searches won't. So make sure pip install -r requirements.txt actually ran.

    Install

    ComfyUI Manager → search "ComfyUI-HTTP" → Install, restart. Manual:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/wawahuy/ComfyUI-HTTP.git
    cd ComfyUI-HTTP
    pip install -r requirements.txt
    

    Where people get burned

    Malformed JSON in json_data returns the error text in both value and formatted_value with count = 0 - it doesn't crash, which is nice, but it means the error is now flowing downstream as if it were data. If you're wiring the extracted value into a prompt or a loader, check count first. And if a path returns nothing, remember it's default_value + count 0, not an exception - so make default_value something you can recognize later.

    CategoryHTTP/JSON

    Inputs (6)

    NameTypeDefaultDescription
    json_dataSTRING{}
    field_pathSTRING$.data
    extraction_methodCOMBOjsonpath3 options: jsonpath, simple, nested
    default_valueoptSTRING
    return_typeoptCOMBOauto3 options: string, json, auto
    multiple_resultsoptBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    valueSTRING
    formatted_valueSTRING
    countINT