Categories

Join Array

Join array items into a single string with a custom separator

Join array items into a single string using a custom separator.

Highlights:

  • Accepts a JSON array
  • Uses the separator exactly as provided
  • Objects/arrays are JSON-stringified before joining

Example:

  • Array: ["a", "b", "c"]
  • Separator: -
  • Result: a-b-c

Enter a JSON array

String placed between items

Key Facts

Category
Data Processing
Input Types
textarea, text
Output Type
text
Sample Coverage
4
API Ready
Yes

Overview

The Join Array tool converts a JSON array into a single string by inserting a custom separator between each element. It handles various data types by converting objects and nested arrays to JSON strings before joining, making it ideal for data formatting and text output tasks.

When to Use

  • When you need to combine array elements into a comma-separated string for reports or exports.
  • When preparing list data for display in user interfaces, logs, or documents.
  • When converting structured JSON arrays into plain text for APIs or data processing pipelines.

How It Works

  • Input a valid JSON array into the 'Array' field, such as ["item1", "item2"].
  • Specify a custom separator in the 'Separator' field; it defaults to a comma and space (", ").
  • The tool processes each element, converting objects or arrays to JSON strings as needed.
  • It outputs a single string with all elements joined by the provided separator.

Use Cases

Generating CSV-like strings from array data for spreadsheet imports or data exports.
Formatting lists for readable output in web applications, reports, or terminal displays.
Preparing array data as a single string for APIs, configuration files, or logging systems.

Examples

1. Create a Simple Comma-Separated List

Data Analyst
Background
You have an array of product names from a database query and need to display them as a single string in a summary report.
Problem
Manually joining array elements is inefficient and prone to errors with large datasets.
How to Use
Paste the array ["Laptop", "Mouse", "Keyboard"] into the 'Array' field and leave the separator as the default.
Outcome
The output is "Laptop, Mouse, Keyboard", ready for insertion into the report.

2. Format Object Array for Debug Logs

Software Developer
Background
You have an array of user objects from an API response and want to log them in a compact, readable format for debugging.
Problem
Logging raw arrays can be cluttered; joining with a separator improves log clarity.
How to Use
Input the array [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}] and set the separator to " | ".
Example Config
{"separator": " | "}
Outcome
The output is "{\"id\": 1, \"name\": \"Alice\"} | {\"id\": 2, \"name\": \"Bob\"}", making logs easier to parse.

Try with Samples

json, text

Related Hubs

FAQ

What format must the array input be in?

The array must be in valid JSON format, like ["value1", "value2"].

Can I use special characters or an empty string as the separator?

Yes, the separator can be any string, including special characters or an empty string for direct concatenation.

How are non-string elements like numbers or objects handled?

Non-string elements are converted to strings; objects and arrays are JSON-stringified before joining.

Is there a limit on the array size or number of elements?

The tool supports arrays of typical sizes, but very large arrays may affect performance.

What is the default separator if none is provided?

The default separator is a comma followed by a space (", ").

API Documentation

Request Endpoint

POST /en/api/tools/join-array

Request Parameters

Parameter Name Type Required Description
array textarea Yes Enter a JSON array
separator text No String placed between items

Response Format

{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}
Text: Text

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-join-array": {
      "name": "join-array",
      "description": "Join array items into a single string with a custom separator",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=join-array",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]