Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-rollup

Rust CI License Tests

Merge thousands of JSON files in milliseconds — parallel, order-preserving, conflict-aware.


Features

Parallel pipeline Files are read and parsed in parallel with rayon
🧠 Auto-schema detection Objects → deep merge, arrays → concat, mixed → helpful error
🥊 Conflict resolution Ranked coercion (object > array > string > number > bool > null) or --strict
🔤 Stable key order IndexMap preserves insertion order across merges
📦 Single binary Zero runtime dependencies

Install

# straight from this repo
cargo install --git https://github.com/suggydev/json-rollup

# or from source
git clone https://github.com/suggydev/json-rollup && cd json-rollup
cargo build --release   # → target/release/json-rollup

Usage

# try it on the bundled examples
json-rollup ./examples --out merged.json

# deep-merge every .json in ./data (recursive)
json-rollup ./data --out merged.json

# force array concatenation / object deep-merge
json-rollup ./data --array  --out all.json
json-rollup ./data --object --out combined.json

# fail loudly on type conflicts instead of coercing
json-rollup ./data --strict --out merged.json

examples/users-1.json + examples/users-2.json merge into:

{
  "app": "rollup-demo",
  "tags": ["a", "b", "c"],
  "limits": { "rps": 100, "burst": 20 },
  "debug": false,
  "owner": "suggy"
}

How it works

  1. Collect — recursively walks input paths for .json files (walkdir).
  2. Parse — every file parsed in parallel (rayon + serde_json).
  3. Infer — all objects → deep merge; all arrays → concat; mixed → error with a hint.
  4. Merge — nested objects merge recursively, arrays concatenate, scalars: later wins; type conflicts resolve by rank or fail under --strict.

Development

cargo test    # 8 unit tests (merger, schema)
cargo clippy  # lints

License

MIT — see LICENSE.

About

Rust CLI that deep-merges thousands of JSON files in parallel

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages