Nodes/ComfyUI_AIIA/AIIA JSON Extractor 🔑
ComfyUI Node

AIIA JSON Extractor 🔑

Reach Into Any JSON String Without a Code Node

By havvk·Created about a year ago·Updated 6 months ago· 13
AIIA JSON Extractor 🔑
    • value
    • value_int
    • value_float
    • found
    json_string
    key_path
    fallback

    The AIIA podcast pipeline is a JSON string factory - script parsers, diarizers, and stitchers all hand structured JSON between nodes. But at some point you want a single field out of that blob: the speaker name, the start time, the text of line 3. AIIA JSON Extractor 🔑 is the pluck-and-convert tool for that, and it's the kind of small utility that saves you from installing a whole JSON toolkit node for one lookup.

    How it works

    Give it a json_string and a key_path, and it navigates into the structure using a dot-path syntax that also supports array indices:

    | key_path | JSON | result | |---|---|---| | name | {"name": "Alice"} | Alice | | data.count | {"data": {"count": 42}} | 42 | | items[0].text | {"items": [{"text": "Hello"}]} | Hello | | [2].speaker | [{}, {}, {"speaker": "B"}] | B |

    Leave key_path empty and it returns the whole JSON re-serialized - handy for pretty-printing a blob for inspection. The value comes out on four typed outputs so you never need a separate convert node:

    • value - the string form.
    • value_int / value_float - safe numeric conversions (0 on failure, never a crash).
    • found - a boolean for whether the path resolved, so downstream logic can branch on success/failure.

    The robustness is the real story here. Bad JSON, a missing key, a path that walks into a number instead of a dict - none of it throws. It cleans BOMs and stray whitespace before parsing, and on any failure it returns the fallback string (empty by default) with found set false. In ComfyUI, where one exception kills the whole graph, that resilience earns its keep.

    The inputs that matter

    • json_string - forceInput, wire it from your parser/stitcher/API node.
    • key_path - the only thing you'll edit. Nested dot-paths and [n] indices are supported; note the index form can start the path (like [2].speaker) since segments like [2] are handled the same as items[0].
    • fallback - your "not found" default. Set it to something meaningful and the rest of your graph doesn't care whether the key existed.

    Where you'll actually use it

    All over the AIIA flow: pull the speaker off a diarized chunk, grab start/end timestamps for the first subtitle line, extract the text from a segment to feed a translation node. It's also the natural pair for AIIA JSON Builder - build a payload, ship it, extract fields on the other side.

    Install

    Standard pack install: havvk/ComfyUI_AIIA via ComfyUI Manager or git clone https://github.com/havvk/ComfyUI_AIIA.git into custom_nodes/, restart. Pure Python, no models, no dependencies.

    CategoryAIIA/Utils

    Inputs (3)

    NameTypeDefaultDescription
    json_stringSTRING
    key_pathSTRING提取路径,支持嵌套和数组索引。例: name, data.items[0].text, [2].speaker
    fallbackoptSTRING解析失败或 key 不存在时返回的默认值

    Outputs (4)

    NameTypeDescription
    valueSTRING
    value_intINT
    value_floatFLOAT
    foundBOOLEAN