From Pairs
Convert array of key-value pairs to object using lodash _.fromPairs
Convert an array of key-value pairs into a single object.
## Features:
- Accepts arrays of [key, value] pairs
- Creates an object from the pairs
- Handles various data types for values
- Supports string, number, and symbol keys
- Uses lodash _.fromPairs for reliable conversion
## Examples:
- Input: [["a", 1], ["b", 2]] → Output: {a: 1, b: 2}
- Input: [["name", "John"], ["age", 30]] → Output: {name: "John", age: 30}
- Input: [[1, "one"], [2, "two"]] → Output: {1: "one", 2: "two"}
## Use Cases:
- **Object Construction**: Build objects from pair arrays
- **Data Transformation**: Convert tabular data to object format
- **Configuration Building**: Create config objects from key-value lists
- **Data Import**: Convert imported pair arrays to objects
API Documentation
Request Endpoint
POST /en/api/tools/from-pairs
Request Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| pairs | textarea | Yes | Enter a valid JSON array of [key, value] pairs |
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-from-pairs": {
"name": "from-pairs",
"description": "Convert array of key-value pairs to object using lodash _.fromPairs",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=from-pairs",
"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]