Get Started Free

More information about MongoDB Extended JSON

JSON has no way to express MongoDB's rich BSON types (ObjectId, Date, 64-bit integers, Decimal128, and more). Extended JSON (EJSON) solves that by wrapping those values in special keys so no type information is lost when you export or move data as text.

The three representations

When you'll use it

You get Canonical EJSON from mongoexport --jsonFormat=canonical and from many driver outputs. Convert to Relaxed for readable logs or docs, or to Plain to feed a tool that expects vanilla JSON.

Frequently asked questions

What is the difference between Canonical and Relaxed Extended JSON?

Canonical keeps every type in an explicit wrapper so it round-trips without loss. Relaxed uses plain JSON numbers and ISO date strings for readability, keeping wrappers only for types JSON can't represent, like Decimal128.

Is converting to Plain JSON lossy?

Yes. Plain JSON strips type information: an ObjectId becomes a string and typed numbers become plain numbers, so you can't reliably convert back to BSON.

Where does Extended JSON come from?

MongoDB tools like mongoexport and the drivers emit Extended JSON so BSON types survive being written as text. Canonical is the lossless form; Relaxed is the human-friendly form.

VisuaLeaf

Work with typed MongoDB data in VisuaLeaf

VisuaLeaf renders BSON types natively, so you edit dates, ObjectIds, and decimals as what they are instead of raw wrappers, across a full MongoDB and SQL client with visual query and aggregation builders.

MongoDB & SQL in one client
Visual query & aggregation builders
Live visual schema diagrams
Charts, dashboards & query profiler
Connection manager for local, cloud & teams
Free Community Edition