Free Online Utility • JSON Studio • RFC 8259 Engine

Convert JSON to BSON

Serialize JSON objects into authentic MongoDB BSON v1.1 binary hex or Base64 documents (0x01 Double, 0x02 String, 0x03 Doc, 0x04 Array, 0x08 Bool, 0x0A Null, 0x10 Int32).

Reference & JSON Spec RFC 8259
Official BSON spec: [int32 total_len LE] + [type_byte cstring value]... + [0x00]
{"hello":"world"} -> exact 22 bytes: 16 00 00 00 02 68 65 6C 6C 6F 00 06 00 00 00 77 6F 72 6C 64 00 00
0x02 / 0x10UTF-8 String / Int32 LE
0x01 / 0x08IEEE 754 Double / Bool
0x03 / 0x04Nested Doc / Array
MONGODB BSON v1.1 BINARY
Encoded BSON Output

        
100% client-side RFC 8259 JSON Engine Instant

Session Calculation Log

No entries recorded in this session yet.

How Convert JSON to BSON Works

Convert JSON to BSON implements the official MongoDB BSON v1.1 binary serialization specification, emitting exact little-endian document lengths, typed element tags (`0x01` Double, `0x02` String, `0x03` Embedded Doc, `0x04` Array, `0x08` Bool, `0x0A` Null, `0x10` Int32), and trailing `0x00` terminators.

JSON (JavaScript Object Notation, RFC 8259) is the universal structured data interchange format across REST APIs, microservices, configuration pipelines, and document databases. Every parsing, transformation, and serialization step in this utility runs completely client-side inside your browser with zero server uploads, guaranteeing instant turnaround and strict privacy even for sensitive payloads.

MongoDB BSON v1.1 Wire Format

Document := int32_LE(total_bytes)  element*  0x00
Element  := type_byte  cstring(key)  typed_payload
Example: {"hello":"world"} -> 16 00 00 00 02 68 65 6C 6C 6F 00 06 00 00 00 77 6F 72 6C 64 00 00

Because every BSON document and string prefixes its exact byte length, MongoDB can skip over sub-documents in `O(1)` time without parsing their contents.

Worked Reference Examples

InputOutputTechnical Note
{"hello":"world"}16 00 00 00 02 ... 00Exact official spec example (22B)
count: 4210 63 6F 75 6E 74 00 2A 00 00 00Int32 tag 0x10
pi: 3.1401 70 69 00 ...IEEE-754 Float64 tag 0x01

Practical Developer & Data Engineering Workflows

MongoDB Wire Protocol Debugging

Generate exact BSON binary hex payloads for driver tests and packet captures.

Binary Format Benchmarking

Compare BSON byte footprint directly against minified JSON and MessagePack.

Compatibility, Edge Cases & Best Practices

Pairs directly with Convert BSON to JSON for lossless round-trip verification.

Copy verified outputs straight to your clipboard or download clean files ready for REST clients, CI/CD configs, database seeds, and unit test suites.

Frequently Asked Questions

Does {"hello":"world"} match the official bsonspec.org example byte-for-byte?
Yes — it outputs the exact 22 bytes `16 00 00 00 02 68 65 6C 6C 6F 00 06 00 00 00 77 6F 72 6C 64 00 00`.
How are integers vs floats encoded in BSON?
32-bit integers use tag `0x10` (4 bytes LE), while floating-point or larger numbers use tag `0x01` (8-byte IEEE 754 Double LE).
Can I export the BSON binary as Base64?
Yes — switch Binary Output Format to Base64 Binary.