ModelWorks logoModelWorks
JSON TransformString

join

Join an array of strings into a single string

join

Joins an array of strings into a single string, inserting separator between adjacent elements.

Options

OptionTypeRequiredDefaultDescription
separatorstringYesSubstring inserted between elements.

Example

Input

JSON
["a", "b", "c"]

Operation

JSON
{ "type": "join", "options": { "separator": ", " } }

Output

JSON
"a, b, c"

In a Circuit Step

JSON
{
  "name": "tags_to_csv",
  "description": "Render an array of tags as a comma-separated string",
  "function": "circuit.core.transform.json",
  "input": {
    "source": "${{ input.tags }}",
    "operations": [
      { "type": "join", "options": { "separator": ", " } }
    ]
  },
  "outputs": [
    {
      "name": "tags_csv",
      "description": "Comma-separated tag string",
      "value": "${{ tags_to_csv.output.transformed_result }}"
    }
  ]
}

Notes & gotchas

  • Errors with join: expected array if the input is not an array.
  • Non-string elements are silently dropped before joining ([1, "a", null] with ,"a"). Coerce to strings first via map if you want them preserved.
  • An empty input array produces an empty string "".
  • For string-array work, join is the natural inverse of split.
On this page

On this page