Extended JSON converter
Convert MongoDB documents between canonical Extended JSON, relaxed Extended JSON and mongosh shell syntax, keeping BSON types like ObjectId, Date, Long and Decimal128 intact.
Runs entirely in your browser. Nothing you paste is sent to any server.
Read as shell syntax · 3 string, 2 binData, 1 objectId, 1 decimal, 1 long, 1 double, 1 date, 1 regex, 1 timestamp
Output
{
"_id": { "$oid": "65f1a2b3c4d5e6f708192a3b" },
"name": "Ada Lovelace",
"balance": { "$numberDecimal": "1024.50" },
"visits": { "$numberLong": "9007199254740993" },
"score": { "$numberDouble": "4.5" },
"joined": { "$date": { "$numberLong": "1710322200000" } },
"tags": [
"admin",
"beta"
],
"avatar": { "$binary": { "base64": "iVBORw0KGgo=", "subType": "00" } },
"sessionId": { "$binary": { "base64": "OyQRAeK7QlWMr0E2xWapYg==", "subType": "04" } },
"email": { "$regularExpression": { "pattern": "@example\\.com$", "options": "i" } },
"lastSync": { "$timestamp": { "t": 1710322200, "i": 1 } }
}Do this against your real data with MotionQL
In MotionQL you can copy any document as Extended JSON or shell syntax, and import or export JSON, JSON Lines, CSV, BSON and Excel. Pro is free for a year.
Three ways to write the same document
JSON has no ObjectId, date, 64-bit integer or binary type, so MongoDB defines Extended JSON: special keys starting with $ that carry the BSON type. The same value looks different in each format:
- Shell:
ISODate("2024-03-13T09:30:00Z") - Relaxed:
{"$date": "2024-03-13T09:30:00Z"} - Canonical:
{"$date": {"$numberLong": "1710322200000"}}
Use canonical when the data must round-trip exactly (backups, fixtures, cross-language tests), relaxed for logs and APIs people read, and shell syntax to paste into mongosh. Query operators such as $gt or $in are left untouched, so you can convert filters and pipelines too.
Questions, answered
More free MongoDB tools
Connection string builder
Build or parse mongodb:// and mongodb+srv:// URIs. Split a pasted URI into hosts, credentials and options, catch common mistakes, and copy a correctly encoded string with the password masked.
Open toolObjectId converter
Decode a MongoDB ObjectId into its creation time, random value and counter, decode many at once, or generate ObjectIds for any date to query by time range.
Open toolBSON size calculator
Paste a document to get its exact BSON size in bytes, see how close it is to MongoDB's 16 MB document limit, and find the fields taking up the most space.
Open toolExplain plan analyzer
Paste the output of explain() to see the plan as a tree, catch collection scans and in-memory sorts, compare documents examined with documents returned, and get an index suggestion.
Open toolOperators cheat sheet
Searchable reference of MongoDB query, update and aggregation operators and pipeline stages, each with example syntax and a link to the official documentation.
Open tool