KeplerGrid guide

Export MongoDB BSON types with Canonical Extended JSON

Export Canonical Extended JSON to keep the exact BSON type of each value. The wrappers make it possible to tell an Int32 count from an Int64 sequence and keep large integers out of lossy JavaScript numbers.

Load one synthetic document with four BSON types

Run this once in mongosh on a disposable MongoDB server with an empty practice collection.

db.getSiblingDB("keplergrid_types_lab").receipts.insertOne({
  _id: "T-001",
  quantity: NumberInt(7),
  sequence: NumberLong("9007199254740993"),
  amount: NumberDecimal("19.90"),
  recordedAt: ISODate("2026-11-25T12:00:00Z")
})

Read the type wrappers in the inspector

Open keplergrid_types_lab.receipts in Documents. Run the filter below, select the returned row and choose Extended JSON in the document inspector. Use Toggle document inspector in the toolbar if needed.

{ "_id": "T-001" }
How the practice values appear in Extended JSON
FieldCanonicalRelaxed
quantity{"$numberInt":"7"}7
sequence{"$numberLong":"9007199254740993"}JSON number
amount{"$numberDecimal":"19.90"}{"$numberDecimal":"19.90"}
recordedAt{"$date":{"$numberLong":"1795608000000"}}{"$date":"2026-11-25T12:00:00Z"}

Relaxed Extended JSON represents some BSON numbers as JSON numbers. A JavaScript parser can round an Int64 above its safe integer limit, so keep the Canonical wrapper when exchanging this sequence. The Canonical date stores milliseconds since the Unix epoch inside its date wrapper.

Export the current page as Canonical JSON Lines

  1. Use Export with the filter above still active. Select Current query page, then Canonical Extended JSON. Click Export documents.
  2. Open the .jsonl file in a text editor. It should contain one line, with the sequence preserved as the string "9007199254740993" inside $numberLong.
  3. If you need every stored document instead, choose Entire collection. The collection export ignores the current filter, sort, projection, and page.

KeplerGrid’s Extended JSON export writes Canonical data. It is suitable for an Extended JSON Lines import into a practice collection, where you can verify the wrappers again.

See how to export every matching result or edit a Decimal128 field and verify its type.

Next, Query a MongoDB ObjectId with Extended JSON.

Convert a MongoDB BSON dump to JSON Lines