BSON Fixer - Repair Broken BSON Extended JSON Online
Paste a MongoDB Extended JSON document that will not parse and get a repaired copy back. Broken $oid, $date and $numberLong wrappers, missing commas, unquoted values and unclosed strings are the usual culprits.
How to Fix BSON Extended JSON Errors - Step by Step Guide
Paste Your Broken BSON Extended JSON
Got broken BSON Extended JSON from your MongoDB exports? Let's fix it. After fixing, use our BSON validator, BSON to JSON converter, or BSON formatter. Paste your problematic BSON data:
Paste broken BSON: Copy error-prone Extended JSON from MongoDB Compass, mongodump exports, or application logs
Common breakage: Broken $oid, $date and $numberLong wrappers, missing commas, trailing commas, unquoted values and unclosed strings
Try sample BSON: Click "Sample BSON" to load a broken document and see the tool in action
Note: Broken documents are sent to our server and repaired by an AI model, so leave out passwords, tokens and keys. A document that already parses is never sent, and nothing is kept — a reload starts with empty editors. For a very large export, paste a single document or the section that won't parse.
Example: Common BSON Extended JSON Errors
Here are typical BSON Extended JSON errors from MongoDB exports:
{
"_id": { "$oid": "507f1f77bcf86cd79943901" },
"name": "John Doe"
"balance": { "$numberDecimal" "1250.75" },
"created": { "$date": "2024-01-15T10:30:00Z },
"status": active
}Click Fix BSON
Click the green Fix BSON!! button. Here is what happens next:
Browser check first: Your document is parsed in the browser. If it already parses as valid Extended JSON, it is shown unchanged and nothing is sent anywhere
AI repair: A broken document goes to our server, where an AI model rewrites it. This usually takes a few seconds
Clear messages: If the fixer is busy, unreachable or takes longer than a minute, you get a plain message instead of a spinner that never stops
Most Common BSON Extended JSON Errors and How to Fix Them
1. Invalid ObjectId Length
MongoDB ObjectIds must be exactly 24 hexadecimal characters.
Wrong:
{"$oid": "507f1f77bcf86cd79943901"}Correct:
{"$oid": "507f1f77bcf86cd799439011"}2. Missing Colon in Type Wrapper
BSON type wrappers require proper JSON key-value syntax.
Wrong:
{"$numberDecimal" "1250.75"}Correct:
{"$numberDecimal": "1250.75"}3. Unclosed Date String
ISO date strings in $date must have matching quotes.
Wrong:
{"$date": "2024-01-15T10:30:00Z}Correct:
{"$date": "2024-01-15T10:30:00Z"}4. Unquoted String Values
All string values in BSON Extended JSON must be double-quoted.
Wrong:
"status": activeCorrect:
"status": "active"Check the Repaired Document
The repaired Extended JSON appears on the right. Read it before you use it:
What gets fixed: Broken $oid, $date, $numberLong and $numberDecimal wrappers, missing commas, trailing commas, unquoted values and unclosed strings
Re-checked: The answer is parsed again. If it still is not valid Extended JSON, a warning says so, because an AI model can get it wrong
Best Practices for Working with BSON Extended JSON
Use Extended JSON v2 (Canonical):
Prefer Extended JSON v2 canonical mode for data interchange, as it preserves all BSON type information unambiguously.
Validate ObjectIds Before Insertion:
Always ensure $oid values are exactly 24 hex characters before importing into MongoDB drivers.
Use mongoimport/mongoexport Correctly:
When using mongoimport, specify --jsonArray for arrays and ensure proper Extended JSON formatting.
Use ISO 8601 for Dates:
Always use ISO 8601 format strings in $date wrappers for cross-platform compatibility and clarity.
Frequently Asked Questions About BSON Fixer
What is BSON Extended JSON, and what does this tool fix?
BSON (Binary JSON) is the binary format MongoDB stores documents in. Extended JSON is its text form, which keeps BSON types like ObjectId, Date and Decimal128 using wrappers such as {"$oid": "..."}. This tool repairs Extended JSON that will not parse: broken $oid, $date, $numberLong and $numberDecimal wrappers, a 23-character ObjectId, missing commas, trailing commas, unquoted values and unclosed strings.
Is my BSON sent to a server?
Only when it is broken. When you click Fix BSON, the page first checks your document with a BSON parser in your browser. If it already parses, nothing is sent and you get it back unchanged. If it does not, the text goes to our server and an AI model repairs it, so leave out passwords, tokens and connection strings before you paste. Nothing is kept — a reload starts with empty editors.
Can the fix be wrong?
Yes. The repair is done by an AI model, so it can guess wrong, for example by changing a value it could not make sense of. The page checks the answer again and shows a warning if it still is not valid Extended JSON, but always read the result before you use it.
Does it handle documents from MongoDB Compass, mongoexport or mongodump?
Yes. Extended JSON from MongoDB Compass, mongoexport, mongodump and application logs all work, including nested documents, arrays and type wrappers. For a document with several errors, send the whole thing in one go so the fixer sees them together.
What if my export is very large?
Small to medium documents work best. A very large export can be slow or fail, so paste a single document or a short section rather than a whole dump at once.
Can I convert the fixed BSON to JSON or validate it?
Yes. Once it is fixed, the BSON to JSON converter, BSON validator and BSON formatter let you take it further.
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 Validator
Validate MongoDB BSON data integrity and structure with type detection
CSV to BSON
Convert CSV spreadsheet data to MongoDB BSON format
BSON Formatter
Format and beautify BSON data with proper JSON indentation
BSON Minifier
Compress MongoDB BSON data to reduce file size and bandwidth