Nodes/smn_support_nodes/[SSN] JSON Get Key Value
ComfyUI Node

[SSN] JSON Get Key Value

Pull one key out of a JSON object without writing a line of code

By SummonTheCat·Created about a year ago·Updated about a year ago· 0
[SSN] JSON Get Key Value
    • value
    ◄json_string{}►
    ◄key►

    [SSN] JSON Get Key Value is the node you reach for when a JSON object lives somewhere in your graph and you need one named field out of it. You feed it a json_string and a key, and it hands back the value for that key as text.

    The pattern this serves is the "configuration in one box" workflow: a single JSON blob at the top of your graph holding width, height, seed, model name, whatever - and a cluster of Get nodes fanning out to feed each value to the right corner of the graph. That's the plumbing layer's repetition-fighting instinct applied to structured data, and this node is the extraction tool for objects (its sibling, SsnJSONGetIndexValue, handles arrays).

    Two practical details worth knowing. First, the json_string input is single-line, so your JSON needs to be compact - {"width": 512, "height": 512} on one line. Paste a pretty-printed multi-line object into this socket and the parse fails (more on that below). Second, the output is json.dumps of the value, so strings come back with their quotes: for {"name": "Sam"}, the output is "Sam" with literal quote characters. That trips people up constantly. If you want the bare text, run the result through SsnJSONGetValueAs's as_string output, which strips the quotes.

    When the key is missing or the JSON is invalid, the node returns an empty string - and it prints a status line to the ComfyUI console ("Key 'x' not found in the JSON data.", "Invalid JSON string provided."). That console output is your best debugging friend here; when a Get node quietly returns "", the terminal is telling you exactly why. It's a small thing, but it's more than most nodes of this kind give you.

    The honest limitations: it's object-only (no nested path access like user.address.city - you'd chain nodes), and there's no default value, so a missing key is an empty string downstream, which can silently propagate. Plan around that.

    Install

    Part of smn_support_nodes by SummonTheCat. ComfyUI Manager → search smn_support_nodes → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SummonTheCat/smn_support_nodes
    

    Restart required. Dependencies (opencv-python, imageio-ffmpeg) auto-install; no models.

    Troubleshooting

    Most problems are one of three: multi-line JSON on a single-line socket (flatten it), forgetting the value comes back quoted (pipe through SsnJSONGetValueAs), or a typo'd key returning "" with a console message you didn't check. Watch the ComfyUI console - this node prints exactly what went wrong. If you're pulling nested data, remember you can chain two of these, but at that point a proper JSON-path node from a bigger pack might be cleaner.

    CategoryJSON

    Inputs (2)

    NameTypeDefaultDescription
    json_stringSTRING{}—
    keySTRING—

    Outputs (1)

    NameTypeDescription
    valueSTRING—