Nodes/ComfyUI Gemini Nodes/Gemini Field Extractor
ComfyUI Node

Gemini Field Extractor

The name is a lie β€” this node doesn't call any API

By jqy-yoΒ·Created about a year agoΒ·Updated 11 months agoΒ· 7
Gemini Field Extractor
    • extracted_value
    • formatted_output
    • extraction_success
    β—„json_inputβ€”β–Ί
    β—„field_pathβ–Ί
    β—„default_valueβ–Ί
    β—„output_formatautoβ–Ί
    β—„array_handlingallβ–Ί
    β—„join_separator, β–Ί

    A free JSON plucker hiding in a Gemini pack

    Here's the twist: GeminiFieldExtractor has nothing to do with Gemini. It makes zero API calls, needs no API key, costs nothing per run. It's a pure Python JSON-path tool that digs one value out of a blob of JSON - which makes it the natural finishing move after any of the API nodes in this pack hand you a wall of structured data. GeminiStructuredOutput gives you JSON, and this node pulls the single field you actually need out of it to feed the next node in the graph.

    If that sounds like a tiny job, it is. That's the point - small, fast, free, no model involved.

    How it works

    You give it a json_input string (raw JSON or even markdown-fenced JSON, which it strips) and a field_path using dot notation:

    • Simple: name, user.email
    • Nested: config.database.credentials.username
    • Array by index: items[0], users[2].name
    • Negative index: items[-1] (last item)
    • All array items: products[*].price - returns every price in the array

    The output_format enum (auto, string, json, number, boolean, list) controls how the value comes back. For arrays there's array_handling - all, first, last, or join (with join_separator for how items get glued together, default ", ").

    The few inputs you'll touch

    • json_input - paste the JSON, or wire it from an upstream node's string output.
    • field_path - the path expression. The placeholders in the UI show the syntax, and testing with a simpler path first is always the right move when a complex one fails.
    • default_value - what comes back when the path doesn't resolve. Make it meaningful; default_value is how you avoid nulls crashing whatever's downstream.
    • output_format / array_handling - for shaping the result. Most runs never touch these past their defaults.

    Outputs: extracted_value (the value), formatted_output (a detailed string with type and structure info - great for debugging), and extraction_success (a BOOLEAN that's true when extraction worked, which you can drive a conditional/switch node with).

    Install

    It installs with the whole pack - there's no separate anything:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jqy-yo/comfyui-gemini-nodes
    cd comfyui-gemini-nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. Note you're still paying for the heavy opencv-python/moviepy deps because the pack installs as one unit, but this node itself is a plain stdlib json walk - no API key, no network, no Google account.

    Where people get burned

    The classic trap is expecting it to do what GeminiJSONExtractor does. It won't - if the JSON is malformed, or the field simply isn't there, there's no model to rescue you. Validate your JSON first (GeminiJSONParser is the pack's own tool for that), check your path syntax against the README's examples, and always set a default_value for fields that might be missing. And one more free tip: since it's local, you can use it to sanity-check anything before you spend an API call asking a model to do the same job.

    CategoryπŸ€– Gemini

    Inputs (6)

    NameTypeDefaultDescription
    json_inputSTRINGβ€”
    field_pathSTRINGβ€”
    default_valueSTRINGβ€”
    output_formatCOMBOauto6 options: auto, string, json, number, boolean, list
    array_handlingoptCOMBOall4 options: first, last, all, join
    join_separatoroptSTRING, β€”

    Outputs (3)

    NameTypeDescription
    extracted_valueSTRINGβ€”
    formatted_outputSTRINGβ€”
    extraction_successBOOLEANβ€”