Shuffle JSON Files Online
Randomly shuffle the row order of JSON files directly in your browser. Useful for randomising data before sampling or ML train/test splits.
How to shuffle JSON files
- Drop your file. The row count, column count and first 200 rows are shown.
- Click Shuffle rows. Every row gets a random position in one pass. There are no settings.
- Check the preview, which now shows the first 200 rows of the shuffled result.
- Click Shuffle rows again for a different order, or download the result in the same format you uploaded.
Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.
Worked example
A small image-classification dataset lists its files grouped by label, all cats first and then all dogs. Taking the first 80% of rows for training would leave almost no dogs in the training set.
Input (JSON)
[
{
"image_id": "img_0001.jpg",
"label": "cat",
"width_px": 640,
"height_px": 480
},
{
"image_id": "img_0002.jpg",
"label": "cat",
"width_px": 800,
"height_px": 600
},
{
"image_id": "img_0003.jpg",
"label": "cat",
"width_px": 640,
"height_px": 640
},
{
"image_id": "img_0004.jpg",
"label": "dog",
"width_px": 1024,
"height_px": 768
},
{
"image_id": "img_0005.jpg",
"label": "dog",
"width_px": 640,
"height_px": 480
}
]Settings
- No options: click Shuffle rows
Result
| image_id | label | width_px | height_px |
|---|---|---|---|
| img_0004.jpg | dog | 1024 | 768 |
| img_0002.jpg | cat | 800 | 600 |
| img_0005.jpg | dog | 640 | 480 |
| img_0001.jpg | cat | 640 | 480 |
| img_0003.jpg | cat | 640 | 640 |
The same five rows are there with every value unchanged, but the labels are now mixed through the file. This is one possible order. Each click produces a new random order and there is no seed to repeat it, so keep the downloaded file if you need the same split later. The first four rows of the shuffled file now make a random 80% sample.
Working with JSON files
A JSON array is ordered, and shuffling moves whole objects to new positions. Each object keeps all its keys and values. Nested objects and arrays inside a record move with it and are not reordered themselves. A file that holds a single object rather than an array loads as one row, so there is nothing to shuffle.
The output is a pretty-printed array with two-space indentation. Every object gets the same keys in the same order, taken from the columns found when the file loaded. A key that was missing from an object in the input appears in the output with the value null. Numbers stay numbers and booleans stay booleans. Integers larger than JavaScript can hold exactly, above 9,007,199,254,740,991, are written as strings so that no digits are lost. Shuffled JSON is handy for feeding records to a labelling tool or a test harness in random order.
Frequently Asked Questions
Are the arrays inside my JSON records shuffled too?
No. Only the order of the top-level records changes. Arrays and nested objects inside each record keep their order.
Why do some shuffled JSON objects have new null keys?
The file is loaded as a table, so every record gets every column. A key that was missing from a record is written as null.
Can I get the same shuffle again?
Not from this tool. Each run uses a new random order with no seed. Save the shuffled file and reuse it. For a repeatable order, use the SQL Query tool and sort by a hash of a key column, for example ORDER BY hash(id).
Does shuffling change any values?
No values are changed and every row is kept. The file is written again by the exporter, though, so formatting can change. For example, a CSV value of 1.50 in a number column is written as 1.5.
How do I make a train and test split after shuffling?
Download the shuffled file, then use the Split tool with the size of your training set as the row count. The first file is your training set and the second your test set. For one random subset without a split, the Sample tool's random mode does it in one step.
Related Tools
Split JSON Files Online
Split JSON files into multiple smaller files by row count, directly in your browser.
Extract Head of JSON Files Online
Extract the first N rows from JSON files directly in your browser. Choose how many rows to keep and download the result — no upload required.
Sample JSON Files Online
Sample rows from JSON files — first N, last N, or random — directly in your browser.
Shuffle CSV Files Online
Randomly shuffle the row order of CSV files directly in your browser. Useful for randomising data before sampling or ML train/test splits.
Shuffle Excel Files Online
Randomly shuffle the row order of Excel files directly in your browser. Useful for randomising data before sampling or ML train/test splits.
Shuffle Parquet Files Online
Randomly shuffle the row order of Parquet files directly in your browser. Useful for randomising data before sampling or ML train/test splits.
JSON Viewer Online
View and inspect JSON files directly in your browser. Browse rows, check column names and data types — no upload required, your data stays on your device.
Convert JSON to Parquet Online
Convert JSON files to Parquet format directly in your browser. No upload required — your data never leaves your device.