Nodes/ComfyUI Gemini Nodes/Gemini JSON Parser
ComfyUI Node

Gemini JSON Parser

The free JSON utility that saves your workflow from itself

By jqy-yoΒ·Created about a year agoΒ·Updated 11 months agoΒ· 7
Gemini JSON Parser
    • result
    • info
    • success
    β—„json_inputβ€”β–Ί
    β—„operationvalidateβ–Ί
    β—„indent2β–Ί
    β—„sort_keysfalseβ–Ί

    Gemini in the name, zero Gemini involved

    Like its sibling GeminiFieldExtractor, this node is a pure local utility. It doesn't call any API, needs no key, and runs instantly - its job is to validate, pretty-print, and dissect JSON that other nodes (usually the API ones in this same pack) produce. If you've ever wired a raw API response into a workflow and gotten a baffling "invalid JSON" error downstream, this is the node that tells you what you actually received.

    It's the debugging sidekick of the pack: a cheap check before you trust something, and a way to understand a blob of JSON without leaving ComfyUI.

    How it works

    Feed it a json_input (raw JSON or markdown-fenced) and pick an operation:

    • validate - checks the JSON and reports its structure. The default, and the one you'll reach for first.
    • format - pretty-prints with indent spaces (0–8, default 2) and optional sort_keys for alphabetical order.
    • minify - strips whitespace for compact storage, and reports the byte savings.
    • extract_keys - lists every key path in the JSON (so {"user": {"settings": {"theme": "dark"}}} yields user, user.settings, user.settings.theme). Invaluable when a Gemini response hands you a nested structure you didn't expect.
    • get_type - maps the JSON's type structure, showing where objects, arrays, strings and numbers actually live.
    • count_items - tallies objects, arrays, strings, numbers, booleans, nulls and total keys.

    Inputs and outputs

    Two inputs beyond the JSON itself: indent and sort_keys, both only relevant for the format operation. Outputs are result (the operation's output), info (a detailed description - the structure summary for validate, byte savings for minify, etc.), and success (BOOLEAN). That success output is genuinely useful: wire it into a switch or conditional and you can branch a workflow on whether the upstream JSON is actually valid.

    Install

    Standard pack install, one line at a time:

    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, then find it under the Gemini menu. No API key required for this one, ever.

    Where people get burned

    The one real failure mode is feeding it something that isn't JSON - at which point success goes false and result carries the parse error, which is the intended behavior, not a bug. The more common workflow-level mistake is skipping the validation step entirely and pasting raw API output into a node that needs clean JSON. The README's own guidance is to chain these: validate β†’ extract keys β†’ extract the field you need. Run validate on anything unfamiliar before you build on top of it, and let extract_keys show you the terrain. Five minutes of this saves an hour of guessing.

    CategoryπŸ€– Gemini

    Inputs (4)

    NameTypeDefaultDescription
    json_inputSTRINGβ€”
    operationCOMBOvalidate6 options: validate, format, minify, extract_keys, get_type, count_items
    indentoptINT20–8β€”
    sort_keysoptBOOLEANfalseβ€”

    Outputs (3)

    NameTypeDescription
    resultSTRINGβ€”
    infoSTRINGβ€”
    successBOOLEANβ€”