# Take Right Items

Take the last N items using lodash _.takeRight

> Canonical page: https://elysiatools.com/en/tools/take-right-items

- **Category:** Data Processing

- **Keywords:** array, take, right, tail, lodash

## Overview

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]`

## Inputs

- **Array** (textarea): Enter a JSON array
- **Count** (number): Number of items to take from the end

## 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.

## Frequently asked questions

### 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.

## Related tools

- [Group By](https://elysiatools.com/en/tools/group-by): Group items by a derived key using lodash _.groupBy
- [Head Item](https://elysiatools.com/en/tools/head-item): Get the first element of array using lodash _.head
- [Index Of](https://elysiatools.com/en/tools/index-of): Find the index of a value in array using lodash _.indexOf
- [Initial Items](https://elysiatools.com/en/tools/initial-items): Get all elements except the last using lodash _.initial
- [Nth Item](https://elysiatools.com/en/tools/nth-item): Get the item at a specific index using lodash _.nth
- [Remove By Predicate](https://elysiatools.com/en/tools/remove-by-predicate): Remove items that match a predicate using lodash _.remove
- [Sorted Index](https://elysiatools.com/en/tools/sorted-index): Find the insertion index in a sorted array using lodash _.sortedIndex
- [Tail Items](https://elysiatools.com/en/tools/tail-items): Return all but the first array item using lodash _.tail

## Samples

- [Grafana Advanced Application Samples](https://elysiatools.com/en/samples/grafana-samples): Comprehensive Grafana samples covering advanced dashboard design, alerting configurations, data source integrations, and plugin development
- [QR Code Samples](https://elysiatools.com/en/samples/qrcode-samples): Sample QR code images for testing QR code reading and generation tools
- [D3.js Data Visualization Samples](https://elysiatools.com/en/samples/d3js-data-visualization): Comprehensive D3.js data visualization examples including charts, maps, animations, and interactive visualizations
- [Rome JavaScript Toolchain Samples](https://elysiatools.com/en/samples/rome): Rome JavaScript toolchain examples including configuration, linting, formatting, bundling, and project management
