Map JSON To Property
Pull One Field Out of an API or LLM Response
- JSON_PROPERTY
Every time an API or a local LLM answers your workflow, it answers in JSON - and 90% of the time you want exactly one field out of the pile. Map JSON To Property is that extraction. You feed it a JSON string and the name of the property you want, and it hands back just that value as a string. Nothing fancier, and that's the point.
It's the natural landing pad for the output of Call Remote URL or Poll Remote URL from this same pack. That node dumps RESPONSE_BODY into your graph as one big string; this one pulls the id, or the url, or the status out of it and feeds it into a text field, a file path, a prompt. Same story if you're piping LLM output through the graph (the KB's LLM-in-ComfyUI picture) - models love returning structured JSON, and this is how you unwrap it.
The two inputs, that's it
json_string- the JSON object string, e.g.{"a": 1}.property_name- what to pull, with dot notation for nested keys:data.user.iddigs through the layers. From the source, you can also index into arrays with numbers:results.0.urlgrabs the first item's url.
One output, JSON_PROPERTY (STRING). If the extracted value is itself an object or array, you get it back as a JSON string - so you can chain this node: pull data out, then run another Map JSON To Property on the result to reach one level deeper. That's the whole art of unwrapping nested JSON in a graph.
Behavior you should know before it bites you
Missing keys don't error - you get an empty string. Invalid JSON gets you an empty string too (technically "" from the decode, or an error string for weird edge cases). So an empty output means something upstream didn't line up: check that the JSON actually parses and that the property path matches the response. There's no "key not found" error to catch your eye, so treat an empty result as "go look at the raw response."
Worth noting: numbers and booleans come back as their string forms (1, true) because the output is always a string. That's almost always what you want downstream, but it means you can't wire this directly into an INT socket and expect the type to hold - you'd be back to an Any Adapter situation.
Install
Part of comfyui-sg-nodes by sebagallo. ComfyUI Manager → search comfyui-sg-nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/sebagallo/comfyui-sg-nodes
Restart ComfyUI; find it under SGNodes/JSON. No model downloads, no extra dependencies.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| json_string | STRING | {} | JSON object string (e.g., {"a": 1}). |
| property_name | STRING | Name of the property to extract. Supports dot notation for nested keys. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| JSON_PROPERTY | STRING | — |