Skip to content
yutils
Example

Input (Extended JSON)

{
  "_id": { "$oid": "5f4a3b2c1d2e3f4a5b6c7d8e" },
  "createdAt": { "$date": "2026-05-13T00:00:00Z" },
  "count": { "$numberLong": "123456789" }
}

Output (plain JSON)

{
  "_id": "5f4a3b2c1d2e3f4a5b6c7d8e",
  "createdAt": "2026-05-13T00:00:00.000Z",
  "count": 123456789
}

Note

Converts MongoDB Extended JSON (from DataGrip, mongoexport, Compass) into plain JSON. The reverse direction is also supported.

Usage / FAQ

When to use

  • Turn DataGrip / Compass EJSON exports into plain JSON
  • Mock API responses based on `mongoexport` output
  • Strip `$oid`, `$date`, `$numberLong` wrappers
  • Make MongoDB documents directly usable in Postman / curl bodies
  • Learn EJSON syntax — see how each BSON type is encoded

FAQ

Q.What is Extended JSON?
A.A MongoDB-standardized way to embed BSON types (ObjectId, Date, 64-bit integers, Decimal128, …) safely inside JSON. Wrappers like `$oid` and `$date` preserve the type.
Q.Strict mode vs Relaxed mode?
A.Strict wraps every type; Relaxed leaves natively representable values (ints, short strings) unwrapped. This tool recognizes both.
Q.Is reverse conversion (plain → EJSON) safe?
A.Reverse conversion infers types (e.g. 24-char hex → ObjectId candidate). For exact BSON types you should write wrappers explicitly.
Fun facts
  • MongoDB's BSON (Binary JSON) was created in 2008 by 10gen (now MongoDB Inc.). It addresses JSON's gaps — missing types (was that Date a string or a number?) and inefficient traversal — by adding distinct types (Date, ObjectId, Decimal128, Binary, …) and length-prefix framing.

    BSON Spec
  • Extended JSON comes in two modes — Canonical and Relaxed. Canonical: `{"$date": {"$numberLong": "1234567890000"}}` (preserves exact type). Relaxed: `{"$date": "2009-02-13T23:31:30Z"}` (human-readable, may lose type fidelity). You pick based on context.

    MongoDB — Extended JSON
  • ObjectId is 12 bytes — 4-byte timestamp + 5-byte random + 3-byte counter. As long as the clock is reasonable, distributed systems can generate near-collision-free IDs. UUID v7 (RFC 9562, 2024) and its timestamp-prefixed design were heavily influenced by ObjectId.

    MongoDB — ObjectId