Skip to content
UniKit

BSON file viewer (MongoDB)

Pick a .bson file (including the concatenated documents mongodump exports) and decode it locally: a structure tree with type, byte offset and length, an Extended JSON view (relaxed or canonical), a hex preview and real stats. Failures report the exact byte offset, and decimal128 keeps its raw bytes instead of a guessed number.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Pick a .bson file (the concatenated documents mongodump exports work too). It is decoded locally in your browser and never uploaded.

Pick a file first.

Result

These are the real numbers from this run — copy them straight out.

Pick a file and set the options; the result shows up here.

What this tool does

  • Inspect a mongodump .bson file without installing mongosh — first see which documents, fields and types it holds
  • Check a field byte offset and length (is that int64 really 8 bytes, which binary subtype is this?)
  • Turn BSON into MongoDB Extended JSON (relaxed / canonical) to paste into mongosh or a config file

Example

Input

1c 00 00 00 10 69 64 00 2a 00 00 00 02 6e 61 6d 65 00 05 00 00 00 75 6e 69 6b 00 00

Output

document 1 (28 B, 2 fields)
  id: 42  [int32 @4 +8]
  name: "unik"  [string @12 +15]

Write those 28 bytes into a .bson file and pick it: the tree reports the type, byte offset and length of every field (int32 takes 8 bytes = 1 type + 3 name + 4 value).

Frequently asked questions

Why is the failure reported as a byte offset?

BSON is binary, so the only honest position is a byte offset. Out-of-range lengths, missing 0x00 terminators, unknown type bytes and invalid UTF-8 all raise "code@offset"; the page also shows the hex around the failure point so you can compare it with the file.

Why does decimal128 only show raw bytes?

The 128-bit decimal combination field is subtle (implicit leading digit, biased exponent), and inventing a decimal string just to fill the panel would risk showing a wrong number. The raw 16 bytes are kept as hex and explicitly labelled as not converted; use mongosh or a driver when you need the exact value.

What is the difference between relaxed and canonical Extended JSON?

Canonical always wraps numbers by type ($numberInt / $numberLong / $numberDouble), which is what you want for lossless exchange; relaxed writes a plain JSON number whenever it fits and only falls back to $numberLong outside the safe integer range. It is easier to read but the consumer has to follow MongoDB relaxed rules.

Does it support compressed files or GridFS chunks?

No .bson.gz / .tar.gz — decompress first. GridFS fs.chunks documents show the real binary subtype and length (including the inner length of old 0x02 binaries), but the chunks are not reassembled into the original file. Everything is parsed locally and nothing is uploaded.

Keywords:mongodbextended json$numberIntejsonobjectid

Related tools