For the complete documentation index, see llms.txt. This page is also available as Markdown.

$join

Concatenates an array (list) of items into a string.

Signature

{{$join array [path] [separator] [final] }}

Arguments

Name
Description
Type
Required

array

Accepts either an array of data or a relative path, as a String, to an array.

StringString ArrayNumber ArrayObject Array

path

If the array is a collection (an array of objects) then use this path to specify which property in the object should be concatenated.

Default value: ", "

String

separator

String that separates each item in the array.

String

final

The string that's used to separate the last two items.

String

Example #1 - Array of strings

{{$join categories ", " " & "}}
{
  "categories": ["Disguise", "Explosive", "Transportation"]
}

Disguise, Maintenance & Transportation

Example #2- Collection (array of objects)

{{$join items "name" ", " " & "}}
{
  "items": [
    { "name": "Glue V1", "price": 9.99 },
    { "name": "Artificial Rock", "price": 26.99 },
    { "name": "Bat-Man's Outfit", "price": 159.99 }
  ]
}

Glue V1, Artificial Rock & Bat-Man's Outfit

Example #3 - Path to array

{{$join "company.employees" "name" ", " " & "}}
{
  "company": {
    "name": "Acme Co.",
    "employees": [
      {
        "name": "Bernadine Burton",
        "role": "Decoy"
      },
      {
        "name": "Good Battle",
        "role": "Field Agent"
      },
      {
        "name": "Dennis Miles",
        "role": "Field Agent"
      }
    ]
  }
}

Bernadine Burton, Good Battle & Dennis Miles

Last updated

Was this helpful?