Array Utilities

Array Unzip

Splits an array of paired elements into two separate arrays, essentially reversing a zip operation. Access via MCP in Cursor or Windsurf, or call GET /v1/array/unzip directly. Input [[1,2], [3,4], [5,6]] returns two arrays: [1,3,5] and [2,4,6]. Perfect for separating coordinates, key-value pairs, or any structured paired data.

API Endpoint

GET /v1/array/unzip

Code Examples

curl "https://tinyfn.io/v1/array/unzip" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/unzip', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/array/unzip',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's array tools:

{
  "mcpServers": {
    "tinyfn-array": {
      "url": "https://tinyfn.io/mcp/array",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How does array unzip work with paired data?

Takes an array of pairs like [[a,b], [c,d]] and returns two arrays: [a,c] and [b,d]. The first array contains all first elements, the second contains all second elements.

Can I unzip arrays with more than 2 elements per subarray?

The function expects pairs (2-element subarrays). With longer subarrays, it extracts only the first two elements from each subarray.

What happens when I unzip an empty array or mismatched pairs?

Empty array returns two empty arrays. If subarrays have different lengths or missing elements, the function handles gracefully by using undefined for missing values.

How do I use array unzip in MCP with AI coding assistants?

In Cursor or Claude Code, request "unzip this array of coordinates" and the MCP tool handles the REST call automatically, returning separated x and y coordinate arrays.

When is array unzip useful in data processing pipelines?

Common for separating coordinate pairs, splitting key-value data, or processing CSV-like paired data where you need columns separated for individual analysis or plotting.

Try Array Unzip Now

Get your free API key and start using Array Unzip in seconds.

Get Free API Key