Detection to BBOX
Detection JSON to a usable bounding box, minus the headache
- bbox
- x
- y
- width
- height
- class_name
- score
The name tells you exactly what it does: hand it one detection object as JSON and it hands you a bounding box - plus the x, y, width, height as separate ints, the class name, and the confidence score. It's the little adapter that sits between "a model that outputs detection JSON" and "nodes that expect a proper BBOX."
That last bit is the whole point. Object detectors (GroundingDINO, YOLO-flavored stuff, SAM-based pipelines) don't speak ComfyUI's BBOX type; they hand you JSON strings with the box buried inside. This node unpacks it into the [[x, y, width, height]] XYWH format that BBox Visualizer, mask nodes, and the rest of the JK-TextTools bbox family speak.
How it works
You feed it a JSON string that looks like this:
{"class": "DOG", "score": 0.9, "box": [100, 50, 200, 150]}
It parses the object, pulls out the box, and emits [[100, 50, 200, 150]] as a BBOX plus the four integers separately. It looks for the key you pick in bbox_key (box or bbox), and if that key isn't there it quietly falls back to checking the other one. Missing or malformed box? You get [[0, 0, 0, 0]] and zeros, but it still passes through class_name and score - handy for keeping a label alive in the graph even when the box is junk.
Inputs and outputs that matter
detection(STRING, multiline) - one detection object as JSON. Default{}.bbox_key(enum,box/bbox) - which key to read the coordinates from.
Outputs: bbox (BBOX), x / y / width / height (INT), class_name (STRING), score (FLOAT). The separate ints are the sleeper feature - you can wire x, y, w, h straight into crop or paste nodes without string parsing anywhere.
Where it fits
The cleanest pairing is with its packmate Detection Query: that node's detection_list output is a list of individual detection objects, and because ComfyUI iterates list outputs, each iteration hands this node exactly one detection. So the loop is: Detection Query → Detection to BBox → BBox to Mask (or a visualizer), and you get per-object masks out of a raw JSON blob.
Installing it
It ships in ComfyUI-JK-TextTools. Easiest path is ComfyUI Manager - search "JK-TextTools" and hit install. If Manager can't find it yet (the README still marks registry publishing as "when published"), clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Nakamura2828/ComfyUI-JK-TextTools.git
Restart ComfyUI. No model downloads, no extra pip installs - the pack's requirements file only lists dev tools, so the runtime need is just ComfyUI plus PyTorch, which you already have.
Gotchas
The classic stumble is feeding it the whole detection list instead of one object. detection expects a single {}, not [{}]. If you're pasting from a raw detector, run the JSON through Detection Query first and wire its detection_list output in. And remember the BBOX type is a community convention shared by packs like Impact and KJNodes - it connects wherever another node declares a BBOX input, and on this pack that's the bbox-to-mask and bbox-to-SAM3-query nodes.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| detection | STRING | {} | — |
| bbox_keyopt | COMBO | 2 options: box, bbox |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| bbox | BBOX | — |
| x | INT | — |
| y | INT | — |
| width | INT | — |
| height | INT | — |
| class_name | STRING | — |
| score | FLOAT | — |