A lightning-fast and efficient 1:1 compatible binary drop-in replacement for JSON
31
174 commits
updated Jul 1, 2026
BONJSON is a hardened, lightning-fast and efficient, 1:1 compatible binary drop-in replacement for JSON.
It's much faster to process than JSON due to the format being designed to take advantage of parallelizable instructions present in modern day processors.
It's also far safer than JSON:
Text formats are great for humans to read, but they're slow and wasteful for computers.
Computers should speak to humans in text (such as JSON), and to each other in binary.
Benchmarking the C Reference Implementation vs jq on a Core i3-1315U (using this test data):
10MB:
~/ksbonjson/benchmark$ ./benchmark.sh 10mb
Benchmarking BONJSON (decode+encode) with 9052k file 10mb.boj
real 0m0.021s
user 0m0.009s
sys 0m0.016s
Benchmarking BONJSON (decode only) with 9052k file 10mb.boj
real 0m0.011s
user 0m0.003s
sys 0m0.012s
Benchmarking JSON (decode+encode) with 10256k file 10mb.json
real 0m0.340s
user 0m0.322s
sys 0m0.024s
BONJSON processed 35.8x faster.
100MB:
~/ksbonjson/benchmark$ ./benchmark.sh 100mb
Benchmarking BONJSON (decode+encode) with 90508k file 100mb.boj
real 0m0.183s
user 0m0.085s
sys 0m0.121s
Benchmarking BONJSON (decode only) with 90508k file 100mb.boj
real 0m0.080s
user 0m0.030s
sys 0m0.071s
Benchmarking JSON (decode+encode) with 102560k file 100mb.json
real 0m3.227s
user 0m3.039s
sys 0m0.232s
BONJSON processed 35.8x faster.
1000MB:
~/ksbonjson/benchmark$ ./benchmark.sh 1000mb
Benchmarking BONJSON (decode+encode) with 905076k file 1000mb.boj
real 0m1.762s
user 0m0.846s
sys 0m1.124s
Benchmarking BONJSON (decode only) with 905076k file 1000mb.boj
real 0m0.746s
user 0m0.300s
sys 0m0.645s
Benchmarking JSON (decode+encode) with 1025564k file 1000mb.json
real 0m31.522s
user 0m29.737s
sys 0m2.307s
BONJSON processed 35.2x faster.
None of them are 1:1 compatible. None of them are safe. Most of them are overcomplicated.
| Encoding | Type Parity | Value Parity | Feature Parity | Safety | Endianness |
|---|---|---|---|---|---|
| BONJSON | ✔️ | ✔️ | ✔️ | ✔️ | Little |
| BSON | ❌ | ❌ | ❌ | ❌ | Little |
| CBOR | ❌ | ❌ | ❌ | ❌ | Big |
| UBJSON | ✔️ | ❌ | ❌ | ❌ | Big |
| BJData | ❌ | ❌ | ❌ | ❌ | Little |
| PSON | ❌ | ❌ | ❌ | ❌ | Little |
| Msgpack | ❌ | ❌ | ❌ | ❌ | Big |
| Smile | ❌ | ❌ | ❌ | ❌ | Big |
Wherever there's a compatibility mismatch, breakage will eventually occur - it's only a matter of time before your complex data pipelines trigger it.
Having confidence in your data plumbing is paramount.
This repository includes a universal test suite for validating BONJSON implementations across any language or platform.
To validate a new implementation:
tests/test-runner-validation/ - if these fail, your conformance results cannot be trustedtests/conformance/See the test suite documentation for details.
Any discussions about JSON are done within the context of the ECMA and RFC specifications for JSON, and the json.org website:
Copyright (c) 2024 Karl Stenerud. All rights reserved.
Distributed under the Creative Commons Attribution License (license deed.
A lightning-fast and efficient 1:1 compatible binary drop-in replacement for JSON
31
174 commits
updated Jul 1, 2026
BONJSON is a hardened, lightning-fast and efficient, 1:1 compatible binary drop-in replacement for JSON.
It's much faster to process than JSON due to the format being designed to take advantage of parallelizable instructions present in modern day processors.
It's also far safer than JSON:
Text formats are great for humans to read, but they're slow and wasteful for computers.
Computers should speak to humans in text (such as JSON), and to each other in binary.
Benchmarking the C Reference Implementation vs jq on a Core i3-1315U (using this test data):
10MB:
~/ksbonjson/benchmark$ ./benchmark.sh 10mb
Benchmarking BONJSON (decode+encode) with 9052k file 10mb.boj
real 0m0.021s
user 0m0.009s
sys 0m0.016s
Benchmarking BONJSON (decode only) with 9052k file 10mb.boj
real 0m0.011s
user 0m0.003s
sys 0m0.012s
Benchmarking JSON (decode+encode) with 10256k file 10mb.json
real 0m0.340s
user 0m0.322s
sys 0m0.024s
BONJSON processed 35.8x faster.
100MB:
~/ksbonjson/benchmark$ ./benchmark.sh 100mb
Benchmarking BONJSON (decode+encode) with 90508k file 100mb.boj
real 0m0.183s
user 0m0.085s
sys 0m0.121s
Benchmarking BONJSON (decode only) with 90508k file 100mb.boj
real 0m0.080s
user 0m0.030s
sys 0m0.071s
Benchmarking JSON (decode+encode) with 102560k file 100mb.json
real 0m3.227s
user 0m3.039s
sys 0m0.232s
BONJSON processed 35.8x faster.
1000MB:
~/ksbonjson/benchmark$ ./benchmark.sh 1000mb
Benchmarking BONJSON (decode+encode) with 905076k file 1000mb.boj
real 0m1.762s
user 0m0.846s
sys 0m1.124s
Benchmarking BONJSON (decode only) with 905076k file 1000mb.boj
real 0m0.746s
user 0m0.300s
sys 0m0.645s
Benchmarking JSON (decode+encode) with 1025564k file 1000mb.json
real 0m31.522s
user 0m29.737s
sys 0m2.307s
BONJSON processed 35.2x faster.
None of them are 1:1 compatible. None of them are safe. Most of them are overcomplicated.
| Encoding | Type Parity | Value Parity | Feature Parity | Safety | Endianness |
|---|---|---|---|---|---|
| BONJSON | ✔️ | ✔️ | ✔️ | ✔️ | Little |
| BSON | ❌ | ❌ | ❌ | ❌ | Little |
| CBOR | ❌ | ❌ | ❌ | ❌ | Big |
| UBJSON | ✔️ | ❌ | ❌ | ❌ | Big |
| BJData | ❌ | ❌ | ❌ | ❌ | Little |
| PSON | ❌ | ❌ | ❌ | ❌ | Little |
| Msgpack | ❌ | ❌ | ❌ | ❌ | Big |
| Smile | ❌ | ❌ | ❌ | ❌ | Big |
Wherever there's a compatibility mismatch, breakage will eventually occur - it's only a matter of time before your complex data pipelines trigger it.
Having confidence in your data plumbing is paramount.
This repository includes a universal test suite for validating BONJSON implementations across any language or platform.
To validate a new implementation:
tests/test-runner-validation/ - if these fail, your conformance results cannot be trustedtests/conformance/See the test suite documentation for details.
Any discussions about JSON are done within the context of the ECMA and RFC specifications for JSON, and the json.org website:
Copyright (c) 2024 Karl Stenerud. All rights reserved.
Distributed under the Creative Commons Attribution License (license deed.