BSON Hex / Base64 to JSON (MongoDB Extended JSON) and Back

See what is inside a BSON blob from MongoDB, or build one from JSON for tests.

Use the tool

Why this tool exists

Decoding handles doubles, strings, embedded documents and arrays, binary with subtype, ObjectId, booleans, dates, null, regular expressions, int32, timestamps, int64, min/max keys and shows Decimal128 as raw hex. Encoding maps integers that fit 32 bits to int32 and other numbers to double, and understands the Extended JSON wrappers for ObjectId, dates, int64, binary, regular expressions and timestamps. Results were compared byte for byte with the official bson library.

Undefined and deprecated types are not written, and Decimal128 is read-only.

No data is sent anywhere: the work happens in your browser, so you can use it offline once the page has loaded.

How to use it

  1. Choose BSON to JSON or JSON to BSON.
  2. Paste hex/base64 or Extended JSON.
  3. Copy the converted data.
  4. Use {"$numberLong":"..."} when you need a 64-bit integer.

Frequently asked questions

What is Extended JSON?

MongoDB's way to represent BSON types that JSON lacks, such as {"$oid": "..."} for ObjectId.

Why did my integer become a double?

Plain JSON numbers outside the 32-bit range are written as doubles. Wrap in $numberLong for int64.

Can I read a .bson dump?

Paste one document at a time as hex or base64.

Is my data sent anywhere?

No. Everything is processed in your browser, and the page makes no network requests with your input.