JB · Extractor
Pull one subtree out of a JSON prompt — for regional detailer passes and reuse
- raw_json
- string
- found
The JB suite builds one big structured document, and then most of the time you want part of it. JB · Extractor is the knife: it pulls one or more named subtrees out of a JSON string and hands them back as their own mini-document. The canonical use is regional detailing - you've stitched a whole character document, but the face-detailing pass only needs character_1.outfit.garments.upper_body, so you extract that one branch and feed it to a regional prompt rather than re-prompting by hand.
It's a small node with a four-mode personality, and the mode is auto-selected by what you type into category.
The four modes
- Single key - type
hairand it recursively searches every nesting level for the firsthairkey, returning{hair: value}. Great when you don't know exactly which level the key lives at. - Dot-path - type
character_1.outfit.garments.upper_bodyand it does a strict descent down that exact path, returning{upper_body: value}. Precise, and fails cleanly if the path doesn't exist. - Multi - separate categories with commas/newlines/semicolons, e.g.
hair, eyes, shoes. Each is resolved independently and the results merge into one{key: value}dict. Missing categories are skipped silently. - Empty - leave
categoryblank and you get the whole input back unwrapped. Handy as a passthrough/debug switch.
The output_format choice (pretty_json, compact_json, loose_keys) applies to whatever comes out. And there's a found boolean output - true if at least one category matched - which you can wire into a condition to branch your workflow instead of relying on string inspection.
What it's actually for
Think of it as the re-use and plumbing node of the JB suite. The Stitcher produces one giant document per character; the Extractor lets you slice that document into focused prompts for different stages - a full-body prompt for the base pass, a hair+face subset for a face detailer, the shoes alone for a footwear ControlNet pass. Because it takes a plain STRING input, it doesn't care whether the JSON came from a Stitcher, a Builder, an Ideogram Assembler, or a text file you typed yourself.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools
No dependencies, pure string parsing, instant. Restart ComfyUI and it's under FVM Tools/JB.
The gotchas
Two, both about silent behavior. Single-key search returns the first match in document order - if hair appears for both character_1 and character_2 and you search single-key, you get whichever comes first, with no warning. Use the dot-path mode when key names repeat. And multi-mode skips missing categories silently: if you ask for eyes, nonexistent_field, you get {eyes: ...} with no error telling you the second one wasn't found - check the found output or the returned document before assuming you got everything.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| json_input | STRING | — | |
| category | STRING | — | |
| output_format | COMBO | loose_keys | 4 options: pretty_json, compact_json, loose_keys, natural |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| raw_json | STRING | — |
| string | STRING | — |
| found | BOOLEAN | — |