BSON to JSON (text) Converter
Explains differences between binary BSON and JSON with a type table and textual conversion examples.
Copiado!
Cole os bytes BSON em hex. Binary/ObjectId viram 0x…; datetime vira ms. int64 pode perder precisão acima de 2⁵³.
BSON é o formato binário usado pelo MongoDB. Ele suporta tipos extras como ObjectId, Date, Binary e Decimal128.
Em JSON estendido (EJSON), esses tipos viram objetos:
{ "_id": { "$oid": "5f..." }, "ts": { "$date": "2024-01-01T00:00:00Z" } }A conversão direta de bytes BSON exige bibliotecas (ex: bson do NPM).
Turning Mongo BSON bytes into readable JSON
You pulled a document out of MongoDB with mongodump, opened it in a hex editor and now you are staring at a wall of bytes. Or a binary blob showed up in a log and you need to know which fields live inside it before writing any code. Paste the hex into the top box and the document appears as indented JSON right below. Whitespace and a leading 0x are ignored.
The decoder reads the 32-bit length header, walks the type-name-value triples and stops at the trailing null byte. It handles double, string, embedded document, array, binary, ObjectId, boolean, UTC datetime, null, int32, timestamp and int64. Binary values and ObjectIds come back as text starting with 0x rather than the EJSON $oid form shown in the explainer. A datetime becomes a millisecond number such as 1715253010752, never an ISO string.
Anything outside that list stops the parse with a not-supported message and the type byte in hex: decimal128 (0x13), regular expressions (0x0b) and JavaScript code all land there. 64-bit integers above 2^53 arrive rounded, because the output goes through a JavaScript number. For whole files, or when those types matter, reach for the bson package on NPM. This page is for peeking at one small document fast, with nothing uploaded.
Frequently asked questions
Do I need to upload the .bson file?
Why does the ObjectId show up with a 0x prefix?
What if the document contains decimal128?
Related Tools
CBOR to JSON (text) Converter
Explains CBOR (RFC 8949), its types and how to represent compact binary values in textual JSON.
MessagePack to JSON (text) Converter
Explains the MessagePack binary format, its advantages and how to translate it into textual JSON.
Binary Code Translator
Convert text to binary code (0s and 1s) and vice versa. Supports any ASCII character. Processed in the browser.
JSON to TypeScript
Convert a JSON to TypeScript interfaces with automatically inferred types. Detects strings, numbers, booleans, arrays, nested objects and union types. Everything in your browser.
YAML to JSON
Convert YAML data to JSON format.
In-Text Unit Converter (Imperial ↔ Metric)
Rewrites every measurement inside a block of text between imperial and metric units, handling fractions, inches, pounds, cups and Fahrenheit.