BSON to JSON Converter & BSON File Viewer Online

Open and convert BSON files or unwrap MongoDB Extended JSON ($oid, $date, $numberLong) into clean JSON.

MONGODB BSON / MONGOSH INPUT
CLEAN STANDARD JSON OUTPUT

What is a BSON to JSON Converter?

A BSON to JSON Converter is a specialized database utility that unwraps MongoDB Binary JSON (BSON) data types, MongoDB Shell (mongosh) scripts, and Canonical Extended JSON representations into clean, standard JavaScript Object Notation (JSON). While MongoDB uses BSON internally to preserve rich data types (like 12-byte ObjectId, 64-bit UTC ISODate timestamps, and 128-bit Decimal128 floating numbers), web browsers and third-party REST APIs cannot natively parse MongoDB-specific syntax without errors.

When you export documents from MongoDB Compass, cloud MongoDB Atlas, or terminal mongoexport dumps, the resulting files are typically filled with type wrappers such as {"$oid": "64f8a12e8b394e1d84a51001"} or {"$date": {"$numberLong": "1786804200000"}}. Our converter unwraps these nested artifacts, converting $oid objects into standard string identifiers, normalizing datetime wrappers into standard ISO 8601 strings (e.g. "2026-08-15T14:30:00.000Z"), and casting $numberLong integers into native numbers.

Why Backend Developers & Frontend Teams Need BSON to JSON

Bridging MongoDB export dumps with modern web development stacks is a critical daily workflow:

Step-by-Step Conversion Example

Below is a real-world demonstration showing how a MongoDB Shell insertMany() query containing ObjectIds and Long integers is transformed into clean, production-ready standard JSON.

Input: MongoDB Shell / BSON Extended Format

db.users.insertMany([
  {
    _id: ObjectId("64f8a12e8b394e1d84a51001"),
    username: "sarah_connor",
    accountBalance: NumberLong("5000000000"),
    createdAt: ISODate("2026-08-15T14:30:00.000Z")
  }
]);

Output: Clean Standard JSON (Unwrapped Primitives)

[
  {
    "_id": "64f8a12e8b394e1d84a51001",
    "username": "sarah_connor",
    "accountBalance": 5000000000,
    "createdAt": "2026-08-15T14:30:00.000Z"
  }
]

BSON Type Unwrapping Mechanics & Rules

Our transformation engine resolves standard MongoDB Extended JSON v2 formats:

  1. ObjectId Unwrapping: Converts {"$oid": "..."} or ObjectId("...") into standard 24-character hexadecimal strings.
  2. Date Normalization: Resolves both ISO strings ({"$date": "..."}) and epoch millisecond timestamps ({"$date": {"$numberLong": "..."}}) into ISO 8601 strings or Unix epoch integers.
  3. 64-Bit Integer Casting: {"$numberLong": "5000000000"} is converted to a native JavaScript number when within Number.MAX_SAFE_INTEGER ($\pm 9\times 10^{15}$).
  4. Decimal128 & Int32 Conversion: NumberDecimal("...") and NumberInt(...) are parsed into standard floating-point and integer primitives.

Programmatic BSON to JSON in Node.js & Python

If you need to automate BSON unwrapping in backend microservices, use these standard libraries:

BSON Binary Subtypes (`$binary`) & UUID Decoding

MongoDB stores binary blobs (such as cryptographic hashes, encrypted tokens, and UUIDs) inside BSON BinData subtypes:

Decimal128 Banking Precision vs. Standard JSON IEEE-754 Floats

Financial services, fintech apps, and banking ledgers running on MongoDB store monetary values using Decimal128 ({"$numberDecimal": "1499.99"}) to prevent the rounding drift inherent to 64-bit binary floating-point calculations. When converting to JSON, our converter allows you to retain exact numeric strings or coerce them into native numbers.

MongoDB Regular Expression Objects (`$regularExpression`)

MongoDB query filters and document indexes often embed regex patterns. The converter extracts pattern strings and regex flags (e.g. {"$regex": "^admin", "$options": "i"}) into standard JavaScript regular expressions or clean JSON metadata.

100% Client-Side Privacy & Air-Gapped Security Guarantee

Converting proprietary database collections containing customer emails, financial transaction records, and user authentication tables requires absolute confidentiality. Uploading MongoDB database dumps to third-party conversion servers creates severe compliance violations and data breach liabilities.

JSON Empire guarantees total browser isolation:

Frequently Asked Questions

How do I open and convert a BSON file to JSON online?

Click "Open File" in the workspace header to upload your .bson binary file, or paste raw MongoDB documents and mongosh scripts directly into the editor. The converter processes the BSON payload immediately in memory and formats clean, human-readable JSON.

What is MongoDB Extended JSON ($oid, $date, $numberLong)?

MongoDB Extended JSON is a standardized format representing BSON type data in JSON using specific type wrappers such as {"$oid": "..."} for 12-byte ObjectIDs, {"$date": "..."} for UTC timestamps, and {"$numberLong": "..."} for 64-bit integers. Our tool strips or flattens these wrappers into standard JSON primitives.

What is the difference between BSON and JSON?

JSON is a text-based format supporting primitive types (strings, numbers, booleans, arrays, objects). BSON (Binary JSON) is a binary serialization format created by MongoDB that supports additional data types such as Date, ObjectId, raw binary buffers, and 128-bit decimals.

What is the difference between Canonical and Relaxed BSON JSON?

Canonical Extended JSON retains explicit type wrappers (e.g. {"$numberLong": "100"}) for exact type preservation. Relaxed JSON converts wrappers into native primitives (e.g. 100) for universal web consumption. This tool converts both into clean Relaxed JSON.

Does this tool support `mongosh` syntax pasted from terminal?

Yes. You can paste raw terminal queries containing ObjectId("..."), ISODate("..."), and db.collection.insertMany(...) directly into the input panel.

Does JSON Empire upload my MongoDB documents to any server?

No. All BSON and MongoDB Extended JSON parsing runs 100% client-side inside your browser sandbox. No sensitive database records ever leave your machine.

Related Database & Data Tools

Work seamlessly across modern databases with our companion utilities: