Loading BSON Formatter...
How to Format BSON - Step by Step Guide
Input Your BSON Data
Let's format your BSON data! Whether you're debugging MongoDB exports, analyzing database dumps, or converting for better readability, you have several convenient options:
Example: Unformatted BSON Input (Base64)
Here's what raw, unreadable BSON data looks like:
dgAAAAJjdXN0b21lcklkAAsAAABDVVNULTEyMzQ1AAJwaG9uZU51bWJlcgAOAAAAKzE1NTUtMTIzNDU2NwACcGxhblR5cGUADQAAAFVubGltaXRlZCA1RwAQZGF0YVVzYWdlR0IALQAAAAhpc0FjdGl2ZQABAA==
Automatic Formatting & Validation
About half a second after you stop typing, the formatter:
Example: Beautifully Formatted Output (JSON)
The same BSON, now decoded and properly formatted:
{ "customerId": "CUST-12345", "phoneNumber": "+1555-1234567", "planType": "Unlimited 5G", "dataUsageGB": 45, "isActive": true }
Choose Format Options
Customize your output based on your needs! The formatter gives you control over how your JSON appears:
Export Your Formatted JSON
Copy and Download both give you exactly what is on screen, indented or minified:
Frequently Asked Questions
How do I format BSON from MongoDB?
Paste the BSON bytes as Base64 or Hex, or upload the .bson file (a mongodump file works too). The page decodes it and shows the documents as Extended JSON indented with two spaces. A file with several documents back to back comes out as a JSON array, one entry per document.
What's the difference between Base64 and Hex input?
They are two text spellings of the same bytes. Base64 is shorter, so APIs and logs tend to use it; Hex takes two digits per byte and is easier to read byte by byte. Pick the one you pasted. If you pick the wrong one, the error message tells you which format the text looks like.
Can I both format and minify BSON?
Yes. The output is indented by default. Minify writes the same JSON on a single line, and Copy and Download always give you exactly what is on screen. Editing the input switches back to the indented view.
Are MongoDB types preserved when formatting?
The output is relaxed Extended JSON, so ObjectId, Date, Binary, Decimal128, Timestamp and regular expressions keep their $oid, $date, $binary, $numberDecimal, $timestamp and $regularExpression wrappers. Long integers such as 8901240544102066246 are written with every digit. Ordinary numbers become plain JSON numbers, which means the text no longer says whether a value was a BSON int32, int64 or double, and a double like 14.50 is shown as 14.5.
What happens if the BSON is broken?
You get a message instead of output. It names a bad Base64 or Hex character with its line and column, says when a document is cut off or has stray bytes after it, and tells you when you pasted JSON text instead of BSON.
Is my data uploaded anywhere?
No. Decoding and formatting happen in your browser and nothing you paste or upload is sent to our server. The tool is free and needs no account. Big files are limited by your browser memory and can take a few seconds to show.
Related Tools
BSON to JSON
Convert MongoDB BSON binary format to JSON for debugging and analysis
JSON to BSON
Convert JSON to MongoDB BSON format for database imports
BSON Fixer
Fix broken BSON Extended JSON automatically, repair malformed MongoDB documents, ObjectIds, and type wrappers
BSON Validator
Validate MongoDB BSON data integrity and structure with type detection
CSV to BSON
Convert CSV spreadsheet data to MongoDB BSON format
BSON Minifier
Compress MongoDB BSON data to reduce file size and bandwidth