Flatten Array
Flatten array one level deep using lodash _.flatten
Flatten an array one level deep (nesting flattened to a single level).
## Features:
- Accepts nested JSON arrays of any depth
- Flattens only one level of nesting
- Preserves deeper nested structures
- Handles arrays with mixed data types
- Uses lodash _.flatten for reliable array processing
## Examples:
- Input: [1, [2, [3]], 4] → Output: [1, 2, [3], 4]
- Input: [["a", "b"], ["c", "d"]] → Output: ["a", "b", "c", "d"]
- Input: [1, [2, [3, [4]]], 5] → Output: [1, 2, [3, [4]], 5]
## Use Cases:
- **Data Preprocessing**: Reduce one level of nesting in structured data
- **Array Normalization**: Simplify nested array structures
- **Batch Processing**: Prepare nested data for processing
- **Data Transformation**: Convert nested arrays to simpler structures
API Documentation
Request Endpoint
POST /en/api/tools/flatten-array
Request Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| array | textarea | Yes | Enter a valid JSON array with nested elements |
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-flatten-array": {
"name": "flatten-array",
"description": "Flatten array one level deep using lodash _.flatten",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=flatten-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]