Protocols and binary formats

BSON viewer

Inspect one BSON document or encode an Extended JSON object. The typed tree and canonical export preserve the meaning of MongoDB values.

BSON viewer

BSON bytes or Extended JSON

Result

Your input stays in this browser; this tool makes no database or network request.

Options

EJSON uses two-space indentation. Input is processed only when you run it.

Choose bytes or an Extended JSON object to begin.

A BSON viewer is useful when a MongoDB collection file looks like unreadable bytes. A BSON to JSON shortcut can show the fields, yet an ordinary JSON conversion may hide whether a value was an ObjectId, Int64 or date.

Use this BSON decoder to inspect the type and absolute offset of each element before you share its Extended JSON. The reverse path creates a fresh BSON file from EJSON; it does not edit your source file.

Why use this BSON viewer?

See the bytes as fields while keeping their original types in sight.

Find the field behind the bytes

The BSON viewer reads one complete document into an ordered tree. Each row shows the BSON type, value preview and absolute byte offset, so a bad length or unknown type points to a concrete place in the source.

A stream of binary tiles opens into an ordered tree with ID, date, number and nested-document icons.

Keep types through Extended JSON

Canonical Extended JSON wraps ObjectId, Int64, Decimal128 and binary subtypes instead of flattening them to ordinary JSON values. The relaxed view is available for reading, with a warning where round trips can lose a type.

Typed document blocks connect in both directions to a brace-shaped Extended JSON structure with distinct type symbols.

Three checks before you export

01

Choose the actual byte source

Hex accepts spaces, colons and hyphens; base64 must be valid and explicitly selected. A .bson file replaces pasted bytes only after you confirm the preview.

  • If a dump contains several concatenated documents, the tool reports the first ending offset instead of silently stopping there.
02

Read the typed tree first

Run decoding manually, then inspect the field order, type and byte offset. Switch between tree, canonical and relaxed EJSON without reparsing the bytes.

  • A stale result cannot be copied or downloaded after you change input or encoding.
03

Export the representation you need

Copy canonical EJSON for type-aware review or download it as JSON; choose relaxed only when readability matters more than a safe type round trip. Encoding writes a new BSON file.

  • Ctrl/Cmd+Enter runs the current direction; a downloaded .bson can be decoded again here.

Inspect, convert and encode one document

Real BSON type inspection

ObjectId, Int32, Int64, Decimal128, date, binary subtype and nested fields remain identifiable in the ordered tree.

Canonical and relaxed EJSON

The Extended JSON converter uses MongoDB type wrappers by default and offers a separate readable view that can lose type fidelity.

A binary file from EJSON

Encode a standard Extended JSON object and download new BSON bytes; hex or base64 makes the resulting payload easy to inspect.

Boundaries that keep the output honest

One complete document
A concatenated mongodump collection is rejected at the first document ending byte. Use bsondump for a multi-document stream.
No silent type flattening
Canonical EJSON is the default text export. Relaxed EJSON can turn Int64 and date values into easier-to-read forms that may not round-trip.
No shell code or database connection
The encoder accepts JSON syntax with EJSON wrappers, not ObjectId(...) expressions. This page never connects to MongoDB or fetches a URL.
Browser resource budget
Files and decoded input are limited to 16 MiB, 64 nested levels and 100,000 tree fields. A limit error is a tool budget, not a BSON format rule.

BSON viewer questions from MongoDB workflows

How do I get JSON from a mongodump BSON file?

For one BSON document, load the file here and download canonical Extended JSON. A collection dump normally contains several documents; this BSON viewer reports where the first ends and asks you to use bsondump for the full stream.

Can this read a BSON file containing many documents?

No. The scanner validates one whole document. If bytes remain after it, the error gives that absolute offset rather than showing only the first document as a successful result.

Can I turn ObjectId and dates into plain JSON?

The relaxed EJSON view makes dates more readable, but canonical EJSON keeps explicit type wrappers. For an API that requires plain strings, transform those fields deliberately after inspection.

How do I see a BSON date in a readable format?

Switch to relaxed EJSON for an ISO date where MongoDB permits it. Canonical output keeps the millisecond value in a $date wrapper for stronger type preservation.

Why does encoding a JSON date string not restore a BSON date?

A plain JSON string has no BSON date type. Use an Extended JSON $date wrapper before encoding; then inspect the resulting BSON type in the tree.

Found a definition that should be supported?

Open the BSON viewer now

Use the BSON viewer to trace one document from bytes to typed fields and canonical EJSON, then encode a new file only when needed.

Processing stays in this browser.