JSON Array Reverser
Reverse the order of the items in a JSON array, so the last item comes first. Optionally reverse nested arrays too, then copy or download the result.
Input
Output
Readme
What is JSON array reversal?
Reversing a JSON array flips the order of its items, so the last item comes first and the first item comes last. It is handy when an API returns records newest-first and you need them oldest-first, when a log or history list is in the wrong order, or when you need test data in the opposite order.
Tool description
This tool reverses a JSON array in your browser. Paste an array, and the reversed version appears right away, ready to copy or download as a JSON file. The items themselves are not changed, only their order.
Features
- Reverses arrays of any values: numbers, strings, objects, nested arrays, or a mix
- Optionally reverses nested arrays too, at any depth, including arrays inside objects
- Formats the result with 2 spaces, 4 spaces, tabs, or as minified JSON
- Keeps numbers exactly as written, so large IDs keep all their digits
- Explains what is wrong when the input is not valid JSON or not an array
How it works
The input is parsed as JSON and must be an array at the top level. The order of its items is reversed, and the result is written back as JSON with the indentation you pick. Objects keep their keys, and in current browsers numbers keep their original text, so values such as 12345678901234567890 or 1.10 are not rounded or shortened. With "Reverse nested arrays" turned on, every array in the document is reversed, not only the outer one. Your data never leaves your device.
Tips
- Reversing an array twice brings back the original order.
- If your array is inside an object, such as {"items": [...]}, paste only the array.
- Pick "None (minified)" to get a single line that fits into code or a request body.