Simple JSON Parser
Pull one field out of a JSON blob without writing Python
- parsed_data
- array_size
If you've ever had a JSON string sitting in your graph - an API response, a saved config, the output of some other node - and needed just one value out of it, you know the annoying part isn't the JSON, it's that ComfyUI has no built-in way to reach into it. You either write a custom script node, or you reach for something like Simple JSON Parser, which is exactly what it sounds like: feed it a JSON string and a path, get the value at that path back out.
It's the entry point of the whole Q-Bug4 pack. Everything else in this collection - the iterators, the modifier, the merge node - assumes you've already got JSON in hand as a string. This is usually the node that gets it there first, or drills into something that's already there.
How it works
There's no schema, no validation step, no config file - it's a json.loads() plus a path walker. You give it json_string, and if you leave path empty, it just parses and hands the whole thing back. If you give it a path, it walks down into the structure and returns only that piece. The path syntax (shared across this whole pack, worth memorizing once): dot notation for nested objects - object.nestedObject.property - and array access either as array[0] or array.0, and you can mix the two: object.array[2].property.
The inputs and outputs that matter
json_string- a multiline string field. Paste or wire in your raw JSON here.path- optional, defaults to empty (meaning "give me everything"). Use the dot/bracket syntax above to drill down.parsed_data(output) - the result, always coming back out as a STRING. If you asked for a nested object, you get that object re-serialized as a string; if you asked for a leaf value, you get that value as a string.array_size(output) - if what you extracted is a list, this tells you how many items are in it. Handy for wiring straight into an iterator node's bound, so you don't hardcode a count that goes stale the moment your JSON changes.
That's the whole node. Two inputs you actually touch, two outputs you wire onward.
How to install it
There's no ComfyUI Manager listing under a snappy name here - search for "Simple JSON Parser" or "Json Node" in Manager and see if it turns up for you; if not, go manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Q-Bug4/Comfyui-Simple-Json-Node
Restart ComfyUI. That's it - no requirements.txt, no model downloads, no extra pip installs. It's pure Python string and dict manipulation, so the install is as light as this kind of node gets. One thing worth flagging if you go digging on GitHub: the README's own clone command points at a differently-named repo (Comfyui-Json-Nodes over SSH) - that's an old rename, the URL above is the current one and the one that matches what ComfyICU actually indexes.
Common issues & troubleshooting
"Invalid JSON string" errors. The README states plainly that malformed JSON raises a ValueError - no silent fallback, no best-effort parse. If your json_string input is coming from another node (say, an API response node) rather than a hand-typed literal, check that upstream node isn't handing you something wrapped in markdown code fences or extra quoting; a JSON string with a stray ```json fence around it will fail here every time.
Path doesn't resolve. Same deal - an invalid path or a key that doesn't exist throws rather than returning null or an empty string. If you're not sure a key exists on every possible input, pair this with JSONKeyCheckerNode from the same pack first, and only call the parser once you know the path is safe. That's a more robust pattern than wrapping this node in a try/except you don't have access to at the graph level.
Array index out of bounds. Also a ValueError, per the README's error-handling section. If your array length varies between runs, pull array_size from a first pass (or from JSONLengthNode) before you hardcode an index into path.
Honestly, for what it does this node is about as low-drama as custom nodes get - it's a thin wrapper around stuff Python already does well. The failure modes are all upstream: bad JSON in, or a path that assumes a shape your data doesn't actually have.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json_string | STRING | — | |
| path | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| parsed_data | STRING | — |
| array_size | INT | — |