Categories

Take Items

Take the first N items using lodash _.take

Take a specified number of items from the start of a JSON array.

Highlights:

  • Uses lodash _.take
  • Supports any array data type
  • Returns the taken items as JSON

Example:

  • Array: [1, 2, 3, 4]
  • Count: 2
  • Result: [1, 2]

Enter a JSON array

Number of items to take

Key Facts

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

Overview

The Take Items tool allows you to quickly extract a specific number of elements from the beginning of any JSON array using the reliable lodash _.take method.

When to Use

  • When you need to truncate a large dataset to preview only the first few entries.
  • When you are processing paginated API responses and need to isolate the initial set of records.
  • When you want to simplify complex JSON structures by extracting a fixed subset of items for testing or debugging.

How It Works

  • Paste your JSON array into the input field.
  • Specify the number of items you wish to extract in the count field.
  • Click the process button to generate the resulting JSON array containing only the requested items.

Use Cases

Extracting the top 5 trending items from a list of daily analytics data.
Truncating long configuration lists for quick debugging sessions.
Isolating the first record of a large dataset to verify schema structure.

Examples

1. Extracting Top Records

Background
A developer has a large JSON array containing hundreds of user logs and needs to inspect the first three entries to verify the data format.
Problem
Manually scrolling through a large JSON file is inefficient and prone to error.
How to Use
Paste the full log array into the input and set the count to 3.
Example Config
Array: [{"id": 1, "event": "login"}, {"id": 2, "event": "click"}, {"id": 3, "event": "scroll"}, ...], Count: 3
Outcome
A concise JSON array containing only the first three log entries is returned.

2. Simplifying Data Samples

Background
A data analyst needs a small sample of a product catalog to create a mock UI prototype.
Problem
The full catalog contains thousands of items, making it too heavy for a quick prototype.
How to Use
Input the product array and set the count to 2 to get a representative sample.
Example Config
Array: [{"name": "Laptop"}, {"name": "Mouse"}, {"name": "Keyboard"}], Count: 2
Outcome
A JSON array with the first two products is generated for immediate use in the prototype.

Try with Samples

json

Related Hubs

FAQ

What happens if the count is greater than the array length?

The tool will return the entire original array without errors.

Does this tool support nested JSON arrays?

Yes, it treats nested arrays as single elements within the parent array.

Is the original array modified?

No, the tool processes the input and returns a new array, leaving your original data untouched.

What is the maximum number of items I can take?

You can take up to 10,000 items as defined by the tool configuration.

What format does the output take?

The output is returned as a clean, valid JSON array.

API Documentation

Request Endpoint

POST /en/api/tools/take-items

Request Parameters

Parameter Name Type Required Description
array textarea Yes Enter a JSON array
count number No Number of items to take

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-take-items": {
      "name": "take-items",
      "description": "Take the first N items using lodash _.take",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=take-items",
      "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]