Nodes/🗂️ Dict Tools/📃Text → Dict🗂️
ComfyUI Node

📃Text → Dict🗂️

Build a whole prompt bundle from one text box

By Lex-DRL·Created 4 months ago·Updated 4 months ago· 1
📃Text → Dict🗂️
  • dict
  • dict
pre_cleanuptrue
dict_text
show_statusfalse

The flagship of the pack

📃Text → Dict🗂️ is the node the whole Dict Tools pack is built around. Give it a wall of text and it parses it into a dictionary of named strings in one shot - no chain of single-value Add nodes required.

Why bother? If you've ever stared at a ComfyUI graph that's grown wires like ivy, you know the appeal of the "bus" idea: bundle a bunch of related values into one connection, pass it down the graph, and unpack it where you actually need each piece. It's the same impulse that made rgthree's Context nodes popular, except here you decide what categories live in the bundle instead of the node author deciding for you. Text is the most common payload, and this is the fastest way to build a text bus.

How the parsing works

The format is dead simple: keys go on their own line, their value goes on the following lines, and blank lines separate items. Anything after the first line in a block becomes the value, joined with newlines. For example:

char1_short
1boy, blond, short hair

char1_long
1boy, smiling, blue eyes, blond, short hair,
wearing a leather jacket, sitting on a bike

That parses into two entries: char1_short and char1_long, the latter carrying a two-line value. It's the same "style preset" concept A1111 users know, but applied as data you can reuse, override, and swap.

The inputs that matter:

  • dict_text - the wall of key-value pairs.
  • pre_cleanup - on by default; each line is stripped of leading/trailing spaces before parsing. Leave it on unless you genuinely need to preserve indentation.
  • show_status - off by default. Flip it on and the node displays the list of detected keys on itself, which makes it much easier to confirm you spelled the keys right before they fail downstream.
  • dict - optional. Pass an existing DICT in and the parsed items get merged on top of it. This is your override mechanism: build a "base" dict, then layer an override on top.

The dict output is a DICT, ready for any Dict Tools extract node. Note that the resulting keys are sorted alphabetically - access is by name anyway, so the ordering doesn't matter, but don't expect insertion order if you inspect the data.

Installing it

Search Dict Tools (Lex-DRL/ComfyUI-DictTools) in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Lex-DRL/ComfyUI-DictTools

Then restart ComfyUI. The only pip dependency is frozendict; there are no models to download and no heavy installs. The pack needs ComfyUI >= 0.18.0 (it uses the newer node API) - if the nodes don't appear after install, update ComfyUI first.

Where people get burned

Keys are case-sensitive and must match the extract node exactly - a typo means a No such key in Dict error, not a gentle failure. Duplicate keys in the text just override each other silently, so don't paste the same key twice expecting both values to survive.

And a note on the [OLD] siblings you'll see in the menu: StringConstructorDictFromText and DictFromText [Dict Tools] are the same node under legacy IDs, kept so old saved workflows still load. Start new graphs with this one.

Category🗂️ Dict Tools

Inputs (4)

NameTypeDefaultDescription
pre_cleanupBOOLEANtrueWhen enabled, each line is individually pre-stripped of any leading/trailing spaces before parsing the text.
dict_textSTRINGA wall of key-value pairs: • keys (item names) on their own line, • followed by their text. Different items are separated by empty lines.
show_statusBOOLEANfalseShow detected string names on the node itself?
dictoptDICTAn (optional) Dictionary to work with.

Outputs (1)

NameTypeDescription
dictDICT