text_converter
Text_converter
- data
- 输出文本
Text handling is the unglamorous half of every serious ComfyUI workflow. Prompt lists come out of scheduling nodes as lists, JSON payloads come out of API nodes, and somewhere between them and the CLIP encoder somebody has to flatten everything into one string. text_converter is that somebody. It's the pack's Swiss-army text node: take any input (list or scalar), and merge it, extract it, encode it, or format it into a single output string. Eleven operations, one wildcard input, zero fuss.
The author's own description calls it a "text conversion tool: automatically recognizes upstream list formats and converts to a single text." That's the pitch. It exists so you stop building ad-hoc chains of Python-script nodes to join a list with commas.
What it actually does
It's marked INPUT_IS_LIST, so it flattens whatever comes in - nested lists, empty items, mixed types - into a clean array, then runs one of the operations on it. The default and most useful one:
- 列表转合并文本 (list → merged text) - joins the list with a separator you pick via
combine_rule:None(return first non-empty item),Line,Space,Comma,Period,Semicolon,Tab,Pipe, orCustom(with\n/\tescape support). This is the one you'll use daily to turn a per-frame prompt list into a single prompt. - JSON转普通文本 (JSON → plain text) - parses JSON and recursively extracts just the string/number content, dropping all the brackets, quotes, and keys. Perfect for pulling usable prompts out of an API response.
- JSON压缩 / JSON美化 - minify or pretty-print JSON (multiple list items become a JSON array).
- Base64编码/解码, URL编码/解码, HTML转义/反转义, Unicode标准化 - the plumbing operations, handy when a node hands you a URL-encoded or base64-wrapped string and you need the plain text.
The code cleans up as it goes - NFKC normalization, stripping non-printable characters - which quietly fixes the invisible-character bugs that plague copy-pasted prompts.
The inputs that matter
- data - required, wildcard. Any list or string. This is where the flexibility comes from: wire it to a prompt-list output, a JSON node, anything.
- operation - the eleven-way selector. Default is list-merge, which is what 90% of users want.
- combine_rule - separator for the merge operation.
- custom_combine_rule - your own separator when
combine_ruleisCustom.
The output
A single 输出文本 (output text) string. One string out, ready for a CLIP encoder, a text node, or another utility.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
cd ComfyUI-Apt_Preset
pip install -r requirements.txt # Windows: double-click install.bat
Or ComfyUI Manager → ComfyUI-Apt_Preset.
Common issues
Two behaviors worth knowing. First, the operations fail gracefully by design - invalid JSON returns the original text with a JSON解析失败 prefix rather than erroring, so a typo in your JSON silently passes through instead of telling you. If your JSON isn't being converted, check that the input is valid JSON first. Second, on Base64解码 / URL解码 it only uses the first non-empty list item, so feeding a multi-item list to a decode operation ignores everything after index zero - merge first if you need the whole list decoded. And keep in mind the whole pack shares one dependency install: this node works fine standalone, but you're pulling pandas and opencv along for the ride whether you use them or not.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| data | * | — | |
| operationopt | COMBO | 列表转合并文本 | 11 options: 列表转合并文本, JSON转普通文本, JSON压缩, JSON美化, Base64编码, Base64解码, +5 |
| combine_ruleopt | COMBO | Comma | 9 options: None, Custom, Line, Space, Comma, Period, +3 |
| custom_combine_ruleopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 输出文本 | STRING | — |