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

Want to test drive the tool?

Before & After Example

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" }
]

Frequently Asked Questions

Code Examples

How to Split JSON Files in Python

Splitting JSON files in Python is straightforward using the built-in json module. Load your large JSON file with json.load(), divide the data into chunks, and write each chunk to a separate file. For array-based JSON, use list slicing to create batches. For object-based JSON, split by keys or nested properties. This is perfect for breaking down large datasets, preparing data for parallel processing, or creating manageable file sizes for APIs with upload limits.

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")

How to Split JSON Files with jq

The jq command-line tool makes splitting JSON files fast and efficient. Use array slicing with .[0:100] to extract ranges, or combine with bash loops to create multiple output files. The -c flag outputs compact JSON, while --slurpfile handles large files efficiently. Perfect for shell scripts, data pipelines, and quick splits without writing code.

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

Complete Splitting Guide

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.