Nodes/ComfyUI_AIIA/AIIA JSON Builder 🏗️
ComfyUI Node

AIIA JSON Builder 🏗️

Stop Typing JSON Into ComfyUI Text Widgets

By havvk·Created about a year ago·Updated 6 months ago· 13
AIIA JSON Builder 🏗️
    • json_string
    key_1key1
    value_1
    key_2
    value_2
    key_3
    value_3
    key_4
    value_4

    The AIIA podcast and diarization nodes all exchange data as JSON strings - which is great for flexibility and maddening when you have to hand-write one. AIIA JSON Builder 🏗️ is the pack's answer: it assembles a JSON object from up to four key/value pairs, so you can build structured data from upstream strings instead of pasting braces. It's a tiny utility node with one job, and it does it without drama.

    How it works

    You get four slots - key_1/value_1 are required, key_2 through key_4 with their values are optional. It drops them into a dict and serializes it as a JSON string. The genuinely useful trick: any value that is itself valid JSON gets parsed into a real type rather than stored as a string. So you can feed a nested object or an array in value_2 and it stays an object/array instead of becoming "\"[...]\"" - that's what keeps downstream JSON Extractor lookups working.

    Example: with key_1=speaker, value_1=A, key_2=lines, value_2=[{"text":"hi"},{"text":"bye"}], you get:

    {
      "speaker": "A",
      "lines": [
        {"text": "hi"},
        {"text": "bye"}
      ]
    }
    

    Numbers and booleans work the same way - value_1=42 comes out as a number, not the string "42".

    The inputs that matter

    Honestly, just the pairs. A couple of practical notes:

    • The value_* inputs are forceInput - they want to be wired from other nodes, which is the whole point (build JSON from pipeline values, not hand-typed text). You can type into them, but the design intent is wiring.
    • Keys are plain strings; empty keys are skipped, so leaving key_3/key_4 blank is fine and won't inject garbage keys.
    • There's no nesting of builders here - if you need a nested structure, build the inner object with a second builder or a string and feed it into a value_* slot, where it'll be parsed as JSON.

    Output is json_string, which plugs straight into AIIA JSON Extractor, the podcast parser nodes, or any node that consumes JSON strings.

    When you'd use it

    It shines in the AIIA podcast flow and in any workflow where you're programmatically constructing payloads - e.g. wrapping per-speaker data before sending it to a downstream processor, or building small config objects. If you already run a heavier utility suite you might have a comparable node, but this one costs nothing extra and matches the pack's JSON conventions out of the box.

    Install

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

    CategoryAIIA/Utils

    Inputs (8)

    NameTypeDefaultDescription
    key_1STRINGkey1
    value_1STRING
    key_2optSTRING
    value_2optSTRING
    key_3optSTRING
    value_3optSTRING
    key_4optSTRING
    value_4optSTRING

    Outputs (1)

    NameTypeDescription
    json_stringSTRING