JSON Key Checker
Check if a key exists before you crash on it
- exists
- value
The other nodes in this pack - the parser, the modifier - will happily throw a ValueError the moment you point them at a key or path that isn't there. Fine when you know your JSON's shape ahead of time; not fine when it's coming from somewhere you don't fully control, like an API response that only sometimes includes a field. JSON Key Checker is the guard node: it tells you whether a key exists, safely, before you try to actually use it.
How it works
It's a lookup with a boolean gate on top. You give it a JSON object and a key name; it checks presence and hands back both an exists flag and, if the key is there, the value itself - so in the common case you don't even need a second node to fetch it once you've confirmed it exists. No exception, no crash, just a straight answer either way.
The inputs and outputs that matter
json_input- multiline string, the JSON object you're checking.key- the key name you're looking for, plain string, no path syntax needed here (this checks a single key, not a nested path - for nested lookups you'd still want JSONParserNode).exists(output) - BOOLEAN. This is what you wire into anything that branches - a Switch, a conditional gate, whatever your workflow uses to route based on true/false.value(output) - STRING, the value at that key if it exists. If the key's missing, don't build downstream logic that assumes this output is meaningful - checkexistsfirst.
That's the whole node: two inputs in, two outputs out, and it's the one node in this pack explicitly built not to throw.
How to install it
Search ComfyUI Manager for "Simple JSON Parser" or "Json Node"; if you don't see it, install directly:
cd ComfyUI/custom_nodes
git clone https://github.com/Q-Bug4/Comfyui-Simple-Json-Node
Restart ComfyUI. Nothing else to fetch - no dependencies beyond Python's own standard library, no model weights, so there's genuinely nothing that can go wrong on the install side beyond the clone itself.
Common issues & troubleshooting
Why does this exist when I could just try/except? You can't - that's the actual reason this node is worth knowing about. ComfyUI's graph has no exception handling primitive; a ValueError from a node like JSONParserNode on a missing key kills the whole run, not just that branch. JSONKeyCheckerNode is how you build the equivalent of a null-check into a graph that has no native concept of one. If you're pulling fields out of JSON that might be genuinely optional - an API response where a field only appears under certain conditions, or a config file where some users omit a key - this is the node that keeps a missing field from taking down the entire queue.
Nested key I need to check doesn't have a path option. Right - this node checks one flat key in one object, it doesn't walk paths the way the parser and modifier do. If what you actually need is "does object.nested.deep.key exist," you're better off parsing down to the parent object first with JSONParserNode and then running the checker against that narrower object.
value output looks populated even though the key was missing. Don't build logic on that assumption - always gate on exists, not on whether value happens to look empty or non-empty. An empty string and "key genuinely absent" aren't guaranteed to look the same on this output, and the README doesn't document a specific sentinel for the missing case, so treat exists as the only reliable signal.
Small node, but it's doing the job that keeps the rest of this pack from being a minefield of uncaught exceptions whenever your input JSON isn't perfectly uniform.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json_input | STRING | — | |
| key | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| exists | BOOLEAN | — |
| value | STRING | — |