BSON (Binary JSON)

A binary-encoded serialization of JSON-like documents, designed to be efficient for storage and scanning.

BSON is the primary data format used by the MongoDB database. It extends the JSON model to include additional data types like dates and binary data, and it is optimized for speed and space efficiency within the database.

BSON vs JSON

FeatureJSONBSON
FormatText-basedBinary
ReadabilityHuman-readableNot human-readable
SizeSmallerLarger due to metadata
PerformanceSlower for parsingFaster for encoding/decoding
Data TypesLimited (e.g., no binary, date)Supports more types (e.g., date, int, binary)
Use CaseAPIs, web appsMongoDB storage and transport
Learn more about JSON and BSON in the MongoDB documentation.