Convert Array to String
Serialize a list into JSON text
- array
- STRING
You've got an array - a list of prompt variants, a list of strings from a Create List node, a bundle of values off some API node - and you need it as a single piece of text. Convert Array to String (ConvertArrayToString) does exactly that, and it's one of those "oh, this exists, finally" nodes for anyone who's ever stared at a list trying to jam it into a text input.
The mental model to lock in up front: this is JSON serialization, not a "join." It turns the whole array into a JSON array as text - ["cat", "dog"] with your indentation choice. That matters because the output includes the brackets and the quotes; it's not "cat, dog". If you wanted a delimiter-joined string, you've got the wrong node - you want Concatenate Text or Format Text. This node is for when the structure needs to survive as text: passing an array onward to something that expects a JSON string, logging it, saving it to a file, or debugging what a list actually contains.
How it works
Mechanically it's json.dumps(array, indent=indent). Two inputs, one output:
- array - an ARRAY-typed input (so a Create List, a multi-value node, or the elements output of a bounding-box node). Its contents can be strings, numbers, nested lists - whatever JSON can express.
- indent - spaces per indent level, 0 to 8, default 2. The tooltip spells out the useful trick: 0 produces a compact single-line string. Default 2 gives you the pretty, readable form with one item per line; 0 is what you want when the text is going somewhere size-sensitive, like a prompt field or a filename.
Output: a single STRING with the JSON text. Indentation is purely cosmetic - ["cat", "dog"] and the pretty version parse identically.
Common issues
The one everyone trips on is expecting a human-readable list ("cat, dog") and getting JSON ("["cat", "dog"]"). Check the node's name again: it's serialization. If that's not what you wanted, this isn't your node. Second gotcha: the output is a string, so if you want the array back, you need the reverse operation - which for a JSON string is parsing it back, and the string-utility family handles the text side while a JSON round trip typically goes through a node that consumes JSON text. Third: indent has a hard cap of 8 - you can't get 10-space indentation, and you don't want it. And if your array contains values JSON can't serialize (some node-internal object types), the conversion can choke - keep arrays of plain values for this node and you'll never hit it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| array | ARRAY | — | |
| indent | INT | 20–8 | Spaces per indent level. 0 produces compact single-line string. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |