Hiprup

What is BSON and how does it differ from JSON?

BSON (Binary JSON) is MongoDB's on-disk and on-the-wire format. A binary representation of JSON-like documents with extra types and length prefixes for efficient parsing.

  • Extra typesObjectId, Date, Decimal128, Binary, Int32/Int64 — not in plain JSON.

  • Length-prefixed — documents and fields carry their size, so the parser skips fields fast.

  • Slightly larger than JSON — trades size for parse speed and richer types.

  • 16 MB max — per document; use GridFS for larger blobs.

  • Drivers handle conversion — clients send/receive language-native objects; driver maps to BSON.

BSON = Binary JSON with extra types. Key extras: Date, ObjectId, Decimal128, Binary.

BSON is for storage (binary, fast), JSON is for interaction (human-readable). The additional numeric types (int32, int64, decimal128) solve JSON's number precision problem.

What is BSON and how does it differ from JSON? | Hiprup