MongoDB Extended JSON Converter
Paste Extended JSON and convert to plain JSON, relaxed EJSON, or canonical EJSON.
Handles every BSON type wrapper drivers emit: $oid, $date, $numberDecimal, and the rest. Nothing leaves your browser.
{"$oid":"…"}) and relaxed ({"$date":"2024-…"}) forms. Plain JSON works too.Three shapes of the same document
Pick the output that matches where the data is going: a frontend, a BSON driver, or a MongoDB shell paste.
Plain JSON
All $-wrappers stripped. ObjectId → hex string, Date → ISO string. Great for frontends, docs, or test fixtures. Lossy for types.
Relaxed EJSON
ISO date strings, bare int32, wrappers only for Long / Decimal / Binary. Matches what mongosh prints.
Canonical EJSON
Every value carries its type wrapper. Round-trips through any BSON driver byte-for-byte. Use for exports and archival.
Frequently asked questions
What is MongoDB Extended JSON?
Extended JSON (EJSON) is MongoDB's JSON dialect. It preserves BSON types that JSON can't represent natively: ObjectId, Date, Decimal128, Int64, Binary, Timestamp, and the rest. Each typed value is wrapped in a $-prefixed object like {"$oid": "…"} or {"$date": "…"}.
What’s the difference between canonical and relaxed EJSON?
Canonical EJSON wraps every value in its type so it round-trips through any BSON driver without ambiguity. Relaxed EJSON uses JSON primitives where the type is unambiguous: bare numbers for int32, ISO date strings instead of {"$date": {"$numberLong": "…"}}. mongosh prints relaxed. mongoexport emits canonical by default.
Which mode should I pick?
Use "Plain JSON" when the consumer (a frontend, a test fixture, documentation) doesn't care about BSON types. ObjectIds become hex strings, dates become ISO strings. Use "Relaxed" when you want a human-readable copy that still distinguishes Long and Decimal. Use "Canonical" when you need lossless round-tripping through a BSON driver.
Does the converter modify my data?
Conversion happens entirely in your browser. Nothing leaves your device. The converter preserves key order within objects, so re-running a conversion is idempotent as long as the target mode stays the same.
Can I go from plain JSON back to EJSON?
The tool doesn't infer BSON types from plain values. There's no reliable way to know if "507f1f77bcf86cd799439011" should be an ObjectId or just a string. For proper round-tripping, start from canonical or relaxed EJSON. If you need to manually wrap a value, paste { "myField": { "$oid": "…" } } and pick your desired output mode.
Are all BSON types supported?
Yes. The tool handles $oid, $date (string, number, and $numberLong variants), $numberInt, $numberLong, $numberDouble, $numberDecimal, $binary, $timestamp, $regex / $regularExpression, $symbol, $code (with or without scope), $uuid, $minKey, $maxKey, and $undefined. Anything else is treated as a regular JSON object and left unchanged.
Work with MongoDB documents daily?
Monghoul gives you tree and table views of every document, with inline editing that preserves BSON types (Long, Decimal128, Date, ObjectId, and the rest). Full Extended JSON support for display and export. Free tier included.
Download Monghoul