ModelWorks logoModelWorks
JSON TransformArray

concat

Concatenate additional arrays onto the current one

concat

Appends the contents of every array in arrays to the current array, in order.

Options

OptionTypeRequiredDefaultDescription
arraysarray<array>YesArrays (literal or selector-evaluated) whose elements will be appended in order.

Example

Input

JSON
[1, 2]

Operation

JSON
{
  "type": "concat",
  "options": {
    "arrays": [
      [3, 4],
      [5, 6]
    ]
  }
}

Output

JSON
[1, 2, 3, 4, 5, 6]

In a Circuit Step

JSON
{
  "name": "merge_history_streams",
  "description": "Combine the primary conversation with auxiliary context messages",
  "function": "circuit.core.transform.json",
  "input": {
    "source": "${{ messages }}",
    "operations": [
      {
        "type": "concat",
        "options": {
          "arrays": [
            "${{ extra_context_messages }}"
          ]
        }
      }
    ]
  },
  "outputs": [
    {
      "name": "combined_messages",
      "description": "Primary messages followed by extra context messages",
      "value": "${{ merge_history_streams.output.transformed_result }}"
    }
  ]
}

Notes & gotchas

  • Errors with concat: expected array if the current value is not an array.
  • Each entry in arrays is selector-evaluated. Non-array values (after evaluation) are silently skipped — they are not coerced into single-element arrays. Use push if you want that behaviour.
  • Selectors work both at the entry level and inside the entries: "arrays": ["${{ extra_messages }}"] and "arrays": [["${{ first_msg }}"]] are both valid.
On this page

On this page