EditSafely

Group a JSON Array

Create groups of JSON array items. Runs entirely in your browser, so your data never leaves your device.

0 chars · 0 lines

Output

The result appears here as you type.

Options

How to use Group a JSON Array

  1. 1. Paste your JSON array. Put the flat JSON array you want chunked into the input pane. Each element keeps its original value; only how they're grouped into sub-arrays changes.
  2. 2. Set the Group size. Enter how many elements should go in each group. The last group holds whatever is left over if the array's length doesn't divide evenly.
  3. 3. Pick an indent. Choose 2 spaces, 4 spaces or tabs for the resulting array of groups, matching the formatting convention of the file you plan to use it in.
  4. 4. Copy the grouped result. Copy the array of arrays and paste it wherever you needed the original flat list broken into fixed-size batches.

When to use Group a JSON Array

Group a JSON Array chunks a flat array into fixed-size sub-arrays. Reach for Group a JSON Array whenever you need to process, display or send data in batches instead of all at once, such as respecting a rate limit or paginating a long list.

  • Batching IDs for a rate-limited API. An API only accepts 50 IDs per request, but you have a JSON array of several hundred. Group them into chunks of 50 before looping through each batch.
  • Preparing rows for a paginated table. A UI component expects data already split into pages of a fixed size rather than paginating a flat array itself. Group the array into the page size you need.
  • Building a GitHub Actions matrix. A large array of test files needs to be split into chunks so each chunk can run as its own job in a CI matrix, keeping individual jobs fast.
  • Dealing out groups from a flat list. You have a JSON array representing a deck or a roster and want to split it into equal-sized hands or teams for a game or exercise.

Examples

Group items into pairs

Input

[1, 2, 3, 4, 5]

Output

[
  [1, 2],
  [3, 4],
  [5]
]

About the Group a JSON Array tool

Group a JSON Array runs as plain JavaScript in your browser tab, with no server behind it. Create groups of JSON array items. Whatever you put in stays on your device from start to finish.

The tool is part of EditSafely's JSON Tools section, 90 single-purpose utilities built around the same idea: open the page, get the result, keep your data to yourself.

You can shape the output with 2 settings, including Group size and Indent, and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.

That local-first design has practical benefits beyond privacy. The tool keeps working on a flaky connection once the page has loaded, results are instant because nothing round-trips to a server, and it is safe to use with confidential material.

Frequently asked questions

Is Group a JSON Array free to use?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.

How much text can I process at once?

There is no fixed limit. Because the work happens on your own device rather than on a shared server, the practical ceiling is your machine's memory, which comfortably handles inputs far larger than typical online tools allow.

Do I need to sign up or install anything?

No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.

Related tools

All JSON Tools