Categories

Take Right Items

Take the last N items using lodash _.takeRight

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

Highlights:

  • Uses lodash _.takeRight
  • Keeps the original order of the tail
  • Returns the taken items as JSON

Example:

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

Enter a JSON array

Number of items to take from the end

Key Facts

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

Overview

The Take Right Items tool allows you to quickly extract a specific number of elements from the end of any JSON array. Powered by the reliable lodash _.takeRight method, this utility ensures your data remains in its original order while providing a clean, formatted JSON output.

When to Use

  • When you need to retrieve the most recent entries from a chronological list or log file.
  • When you want to isolate the tail end of a large dataset for quick analysis or debugging.
  • When you need to truncate an array to a specific size while keeping only the final items.

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 subset of your data.

Use Cases

Extracting the last 5 transaction records from a large JSON export.
Retrieving the most recent error logs from a system status array.
Filtering a list of user IDs to get only the latest sign-ups.

Examples

1. Extracting Recent Logs

Background
A developer has a long JSON array of server logs and needs to inspect the last three entries to troubleshoot a recent crash.
Problem
Manually scrolling through hundreds of lines of JSON is inefficient and prone to error.
How to Use
Paste the full log array into the input and set the count to 3.
Outcome
The tool instantly returns only the final three log objects, allowing for immediate analysis.

2. Getting Latest Transactions

Background
An analyst is working with a daily transaction history array and needs to isolate the final 10 purchases for a quick report.
Problem
The dataset is too large to parse manually, and standard text editors make it difficult to select specific array segments.
How to Use
Input the transaction array and set the count to 10.
Outcome
A clean JSON array containing exactly the last 10 transactions is generated, ready for copy-pasting into a report.

Try with Samples

json

Related Hubs

FAQ

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

The tool will return the entire array as it cannot take more items than are available.

Does this tool modify my original data?

No, the tool only processes the input provided and returns a new result; your original data remains unchanged.

Is the order of the items preserved?

Yes, the tool maintains the original sequence of the items as they appeared at the end of the input array.

What format should the input be in?

The input must be a valid JSON array, such as [1, 2, 3] or ["a", "b", "c"].

Can I use this for nested JSON objects?

Yes, as long as the input is a valid JSON array containing objects, the tool will correctly extract the last N objects.

API Documentation

Request Endpoint

POST /en/api/tools/take-right-items

Request Parameters

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

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