BSON Converter
Decode BSON, the binary format of MongoDB, into Extended JSON, or encode Extended JSON as BSON bytes. Paste a document as hex or Base64 and see ObjectIds, dates, 64-bit integers and binary data in MongoDB Extended JSON. Choose relaxed output for readability or canonical output that keeps every type.
Frequently asked questions
What is BSON?
BSON is the binary document format that MongoDB stores and sends. It extends the JSON data model with types such as ObjectId, Date, 32 and 64-bit integers, Decimal128 and binary data.
What is Extended JSON?
MongoDB Extended JSON writes BSON types that JSON lacks as small objects, such as {"$oid": "..."} for an ObjectId or {"$date": "2024-01-01T00:00:00Z"} for a date. The same notation is accepted when encoding.
What is the difference between relaxed and canonical?
Relaxed output writes numbers as plain JSON numbers and dates as ISO strings, which is easier to read. Canonical output keeps every type, for example {"$numberInt": "5"} or {"$numberLong": "5"}, so the document can be converted back without loss.
Can I encode an array or a single value?
No. A BSON document is always an object at the top level. Wrap other values in an object, such as {"items": [...]}.
How do I get BSON bytes to paste?
From a mongodump .bson file, a network capture or a driver, as hex or Base64. Paste one document; the length at the start of the bytes must match the data.
Why is my BSON rejected?
The bytes do not form one valid document, for example because the length prefix does not match, the data is cut off or a string is not valid UTF-8. The message gives the reason reported by the decoder.