Nodes/was-node-suite-comfyui/Text Dictionary Convert
ComfyUI Node Runs on cloud

Text Dictionary Convert

Turn formatted text into a dictionary object

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Text Dictionary Convert

      WAS Node Suite has a small family of dictionary nodes built around structured prompt data: Text Dictionary New builds one from scratch, Text Dictionary Update merges two, Text Dictionary Get pulls a single value out, Text Dictionary Keys lists what's in it, Text Dictionary To Text dumps the whole thing back out as a string - and Text Dictionary Convert, the node here, is the entry point when your data starts life as text instead of being assembled node-by-node inside the graph. Per the README, it does exactly that: "convert text to dictionary object."

      Why you'd start from text instead of building a dictionary in-graph

      Not every dictionary you want to work with originates inside ComfyUI. You might have config pasted from somewhere else, a block of text loaded from a file, or a hand-typed list of settings - data that already exists as text and would be tedious to reconstruct one key at a time with a chain of Update nodes. Text Dictionary Convert lets you skip that: hand it formatted text, and it gives you back a DICT object the rest of WAS's dictionary family can operate on directly - get a value out by key, list the keys, merge it with another dictionary, or push it back to a Text Dictionary Get downstream.

      How it works

      It's the exact reverse of Text Dictionary To Text: instead of serializing a dictionary into readable text, it parses formatted text - structured as key/value pairs - back into a DICT object. Our source material this round doesn't spell out the precise delimiter syntax it expects, so if you're building input text by hand, the most reliable way to learn the exact format is to build a small dictionary with Text Dictionary New, run it through Text Dictionary To Text, and match your hand-written input to whatever that round-trip produces - that guarantees your text is shaped the way this node actually wants it, rather than guessing.

      The inputs and outputs that matter

      A text input containing the formatted key/value data, and a DICT output ready for the rest of the dictionary family - Text Dictionary Get to read a value, Text Dictionary Keys to list what came through, Text Dictionary Update to merge it with another dictionary you built elsewhere.

      Installing it

      ComfyUI Manager: search "WAS Node Suite," install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install requirements.txt against your ComfyUI Python, restart. No model, no heavy dependency.

      Common issues & troubleshooting

      The result is empty, or keys are missing. Format mismatch is the near-universal cause - your input text doesn't line up with the delimiter or structure the parser expects. Test the round-trip described above (build a dict manually, serialize it with Text Dictionary To Text, compare the shape) before assuming the node is broken; nine times out of ten the fix is reformatting the input text, not anything wrong with the node.

      Values came through as the wrong type. Dictionary values here are text-native - if you need a number back out, run the result through one of WAS's Number conversion nodes after pulling it with Text Dictionary Get, the same way you would for any dictionary value sourced from text.

      Whole pack fails to import. WAS Node Suite has been unmaintained since the author marked it retired in December 2023, and the recurring failure since is the entire suite throwing "Import Failed" after a ComfyUI update from a pinned dependency clash. Reinstall requirements.txt against the correct, embedded Python interpreter and restart - the dictionary nodes themselves have no external dependency of their own.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs