99 JSON Pick
Grab a value out of any JSON blob — ZMongo 99 JSON Pick
- value
99 JSON Pick is the pack's "take JSON in, give me one field out" utility. You hand it a JSON string and a dot-path, and it walks the path and returns the value as a string. No database, no session, no setup - just parse, navigate, return. It's the simplest node in ComfyUI-ZMongo, and one of the handiest.
Why does it exist in a database pack? Because most of the pack's read nodes hand you their results as JSON strings. 03 Get Doc returns a whole document as JSON; 03 Query Docs returns a response envelope. If you want positive_prompt out of that blob, you have two options: the database-aware 03 Get Value (which needs a session and re-fetches the doc), or this lightweight pure-function node that just picks a key out of the text you already have. When the data's already in your graph, JSON Pick is the cheaper move.
How it works
It does json.loads on json_text, then walks the dot-path segment by segment. Dicts index by key, lists index by integer - so variants.0.positive means "the positive field of the first element of variants". If any step fails or the field is missing, you get fallback back. That's the whole mechanism, and it's deterministic and fast.
Outputs: a single value string. Scalars are stringified (null becomes empty), while dicts and lists are returned JSON-serialized - so you can chain one JSON Pick into another to drill deeper. There's a fallback input (default empty) for when you'd rather have a sane default than a blank.
The inputs that matter
Only three:
json_text- the JSON string to parse. Invalid JSON →fallback.path- the dot-path, defaultdata. This is what you'll edit constantly.fallback- what to return on any miss.
Install
Standard:
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
cd ComfyUI-ZMongo
pip install -r requirements.txt
or ComfyUI Manager → "ComfyUI-ZMongo" → restart. Nothing special needed - this node doesn't even need a session.
Troubleshooting
- Always getting
fallback- your path is wrong for the actual JSON shape. Wire thejson_textinto a preview node first and eyeball the structure; the most common mistake is assuming a key exists one level up or down from where it does. - List index errors -
variants.0works whenvariantsis a list. If it's a dict, use the key name instead. The node converts the segment to an int when it encounters a list, so a non-numeric segment there fails cleanly tofallback. - Numbers that look like strings - everything comes out as a string (that's ComfyUI's way); convert with a math/int node downstream if you need arithmetic.
JSON Pick won't be the star of your workflow, but it's the quiet workhorse that turns raw API responses into usable values - and it works anywhere in the graph, not just on ZMongo's own outputs.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| json_text | STRING | {} | — |
| path | STRING | data | — |
| fallback | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | STRING | — |