Free Online JSON File Splitter Tool

Opening a massive JSON file can crash your browser or code editor. This tool helps you break large JSON datasets into smaller, manageable chunks. You can split by object count or file size, and since it runs locally on your machine, your data stays private and the processing is instant.

JSON File Splitter

Practice Splitting with Sample Files

Before & After

JSON array split into chunks

Original File
json
[
  { "id": 1, "name": "Alice", "role": "admin" },
  { "id": 2, "name": "Bob", "role": "editor" },
  { "id": 3, "name": "Charlie", "role": "viewer" },
  { "id": 4, "name": "Diana", "role": "admin" },
  { "id": 5, "name": "Eve", "role": "editor" },
  { "id": 6, "name": "Frank", "role": "viewer" }
]
Split Output
json
// chunk_1.json
[
  { "id": 1, "name": "Alice", "role": "admin" },
  { "id": 2, "name": "Bob", "role": "editor" },
  { "id": 3, "name": "Charlie", "role": "viewer" }
]

// chunk_2.json
[
  { "id": 4, "name": "Diana", "role": "admin" },
  { "id": 5, "name": "Eve", "role": "editor" },
  { "id": 6, "name": "Frank", "role": "viewer" }
]

Visualize the Split

See how files are chunked

Split by File Size

data.json50 MB
chunk_110 MB
chunk_210 MB
chunk_310 MB
chunk_410 MB
chunk_510 MB

Split by Array Count

users.json[10,000 items]
chunk_1[2,000]
chunk_2[2,000]
chunk_3[2,000]
chunk_4[2,000]
chunk_5[2,000]

Programmatic Split

Python and jq scripts

Pythonsplit_json.py
import json, math, sys

with open("large_file.json") as f:
    data = json.load(f)

chunk_size = 2000
chunks = [data[i:i+chunk_size] for i in range(0, len(data), chunk_size)]

for idx, chunk in enumerate(chunks):
    with open(f"chunk_{idx+1}.json", "w") as out:
        json.dump(chunk, out, indent=2)

print(f"Split into {len(chunks)} files")
Bash (jq)split_json.sh
# Split a JSON array into chunks of 1000 items each
jq -c '[., range(0; length; 1000)] | .[]' large_file.json \
  | jq -s '.' \
  | split -l 1000 - chunk_

# Or use jq to extract by size (e.g., first 500 items)
jq '.[0:500]' large_file.json > chunk_1.json
jq '.[500:1000]' large_file.json > chunk_2.json

# Split by key pattern
jq 'to_entries | group_by(.key[0:1])
  | .[] | from_entries' large_object.json

Use Cases

When to split JSON files

API Payload Limits

Break oversized JSON responses into chunks that fit within API gateway limits (e.g., AWS 10MB, Shopify 5MB) so each request succeeds without truncation.

Database Batch Imports

Split a massive JSON export into smaller batches for sequential database imports, avoiding transaction timeouts and memory pressure on your DB server.

Parallel Processing

Divide a large dataset into N chunks and process them concurrently across workers, threads, or serverless functions for dramatically faster throughput.

Editor-Friendly Sizes

Turn a 500MB JSON dump into files small enough to open in VS Code or Sublime without freezing, so you can actually inspect and edit the data.

FAQ

Common questions

Complete Guide

In-depth walkthrough

Split by count vs split by size — which to use

Use split by count when you need equal chunks for parallel processing or pagination. If you have 10,000 user records and want to process them across 5 workers, splitting into chunks of 2,000 gives you predictable, evenly distributed workloads. Split by count is more predictable for developer workflows where you need to know exactly how many items are in each file.

Use split by size when you're working with upload limits or memory constraints. For example, if you're uploading to an API that has a 50MB file size limit, splitting a 500MB export into 50MB chunks ensures every file will upload successfully. Split by size is better when the constraint is storage or bandwidth, not item count.

What happens to nested objects when you split

The tool splits at the top-level array level. If your JSON is an array of user objects, each chunk will contain complete user objects with all their nested data intact. Each chunk is a valid, complete JSON file that you can immediately use in another tool or script.

If your JSON is not a top-level array (it's an object like {"users": [...], "meta": {...}}), the tool will flag this. You need to either extract the array part first, or specify which key contains the array you want to split.

Using the output files in Python, jq, and Node

In Python, use glob to loop over the split files: for file in glob.glob("chunk_*.json"). In jq, use the --slurp flag to combine them back: jq -s 'add' chunk_*.json. In Node, use fs.readdirSync() to read all chunk files and process them sequentially or in parallel.

Each chunk is a standalone JSON array, so you can process them independently without needing to reference other chunks. This makes parallel processing straightforward across multiple threads or serverless functions.

Related Articles