Nodes/Quality of Life Nodes for ComfyUI/JSON String Parser (10X) (Soze)
ComfyUI Node

JSON String Parser (10X) (Soze)

Ten values out of a JSON document — keys in, strings out

By SozeInc·Created 2 years ago·Updated 8 days ago· 10
JSON String Parser (10X) (Soze)
    • value_1
    • value_2
    • value_3
    • value_4
    • value_5
    • value_6
    • value_7
    • value_8
    • value_9
    • value_10
    json_string
    key_1
    key_2
    key_3
    key_4
    key_5
    key_6
    key_7
    key_8
    key_9
    key_10

    Somewhere in your workflow there's a JSON document - an API response, a config file, a CSV row that was JSON-stringified - and you need a handful of its fields as plain strings to feed the rest of the graph. JSON String Parser (10X) (Soze) is the cheap way to do it: paste/feed one JSON string in, type up to ten key paths, get ten string outputs. A missing key doesn't kill the run; that slot just comes back empty.

    It's the read-side sibling of the Soze JSON builder family. The builder nodes construct JSON; this one dismantles it. Where the full-blown JSON Path Extractor node has fancier conventions and error modes, this node deliberately keeps it simple: 10 named key widgets, 10 named string outputs, no word limits, no defaults to trip over. "A missing or invalid key just yields an empty string for that slot and the node keeps going," as the source puts it.

    How it works

    Each key_N widget accepts one of three forms:

    • a bare top-level name - Story
    • a dotted path - Story.Name
    • indexed access - items[0].id or 0.title

    On execution it parses the JSON (loosely - it'll take slightly-malformed input where it can) and walks each key path. Primitives are stringified as-is, objects and arrays are pretty-printed back to JSON, and null becomes an empty string. It counts hits and reports OK: extracted 7/10 key(s) in the status.

    Inputs and outputs

    • json_string - required, the JSON document (multiline).
    • key_1 … key_10 - required string widgets; type the paths you want. Leave blank to skip that slot.

    Outputs: value_1 … value_10, all STRING. Wire them into prompt builders, filename nodes, CSV writers - anywhere text goes.

    json_string = {"name":"Alice","meta":{"age":30},"tags":["a","b"]}
    key_1 = "name"        → value_1 = "Alice"
    key_2 = "meta.age"    → value_2 = "30"
    key_3 = "tags[0]"     → value_3 = "a"
    

    Installing it

    Part of the Soze pack:

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

    Restart ComfyUI, or search ComfyUI_Soze in ComfyUI Manager.

    Gotchas

    Everything out of this node is a string, even numbers - 30, not 30. That's fine for text slots, but if the downstream node genuinely needs an INT or FLOAT, run the value through a converter. Also note it re-executes every run (IS_CHANGED always returns changed), so don't be surprised if it shows as dirty even when nothing changed - that's deliberate, so edited files always get re-parsed. And if you have deeply nested or wildcard-heavy extraction needs, the JSON Path Extractor node in the same pack is the heavier-duty alternative.

    Categoryutils

    Inputs (11)

    NameTypeDefaultDescription
    json_stringSTRING
    key_1STRING
    key_2STRING
    key_3STRING
    key_4STRING
    key_5STRING
    key_6STRING
    key_7STRING
    key_8STRING
    key_9STRING
    key_10STRING

    Outputs (10)

    NameTypeDescription
    value_1STRING
    value_2STRING
    value_3STRING
    value_4STRING
    value_5STRING
    value_6STRING
    value_7STRING
    value_8STRING
    value_9STRING
    value_10STRING