Skip to content
Monghoul

Extended JSON and BSON

How ObjectId, Date, Decimal128, Long, UUID and Binary survive a round trip through the app.

Checked against v1.11.0 Updated
A query result as Extended JSON, with $oid and $date wrappers around the typed values
Extended JSON · The wrappers that carry a type through a round trip
  • ObjectId, Date, Binary, Timestamp, UUID, MinKey, MaxKey, RegExp, Code, DBRef, and the numeric BSON types all get type-aware presentation
  • Color-coded type badges stay consistent across Tree View, Table View and the inline editors. Exports carry no badges and no BSON typing
  • BSON constructors in the editor: ObjectId(), Long(), Int32(), Double(), Decimal128(), UUID(), BinData(), Timestamp(), and ISODate() from the date helper
  • Copy, edit, insert, clone, and filter actions generate runnable constructor syntax when the decoded result kept its type and exact value
  • Results display as relaxed Extended JSON, which is not a lossless round trip for every numeric subtype
  • Int32, Double and a 64-bit integer inside ±9,007,199,254,740,991 arrive as ordinary JSON numbers. The value is exact; what is lost is the TYPE, so an in-range Long badges as a number and the inline editor writes it back as an Int32 or a Double
  • A 64-bit integer outside that range arrives with its type intact and keeps it through an edit
  • Once relaxed decoding has dropped a subtype or precision it cannot be reconstructed, and generated actions use the decoded value
  • Canonical Extended JSON import and export are the supported paths when subtype and precision have to round-trip losslessly
  • Relaxed is the export default and writes a 64-bit integer as a plain JSON number, which is inexact above 2^53. Choose canonical when the values have to come back exactly