Skip to content
Tesserae

Keyboard shortcuts

Focus search
/
This help dialog
?
Run the current tool
Ctrl/⌘ +Enter
Copy the output (when an output is focused)
Ctrl/⌘ +C

Shortcuts are ignored while you are typing in an input, a textarea or a select.

Developer Utilities

JSON to MongoDB

Turn a JSON array (or single object) into a ready-to-run mongosh command: db.<collection>.insertMany([...]);. JSON is embedded verbatim as JavaScript object literals so exact types survive — no quoting surprises. Choose compact or pretty formatting, toggle the wrapper, and pick your collection name.

On-device No network Offline-ready

🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.

Try:

Options

Your result will appear here

Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.

How it works

From JSON to a runnable mongosh command

Paste a JSON array of documents — or a single object — and the tool emits db.<collection>.insertMany([ … ]); ready to paste into mongosh or a MongoDB shell. Because the JSON object literals are embedded verbatim, types survive the trip: a number stays a number, a boolean stays a boolean, and nested objects and arrays map one-to-one onto BSON documents and arrays.

The options that shape the output

Collection name sets the identifier used in the script. Output format switches between a compact single line and pretty multi-line output. Wrap in db.collection.insertMany lets you drop the script wrapper and get just the raw documents, for pasting into another tool. Indent width controls the pretty-print step from 0 to 8 spaces. The collection name is validated as a MongoDB identifier, so letters, digits and underscores only — a dash or space is rejected up front.

A typical workflow

You exported some rows as JSON from an API or a spreadsheet and want them in a scratch collection for testing. Paste the array, set the collection name, copy the generated script, and run it against your dev database. There is no file to upload and no driver to install — the script is plain text you can read, review and commit alongside code.

Limits and privacy

Every item must be a JSON object, so a bare array of scalars or a null element is rejected with a message naming the offending index; a non-finite number such as NaN is rejected too, since JSON has no way to express it — use null instead. Input is capped at roughly two million characters. The conversion is done entirely with the browser’s JSON parser, with no network call, so your data stays on your device.

Questions

Is this valid mongosh input?

Yes — the JSON is embedded as JavaScript object literals, exactly what mongosh executes. Numbers, booleans, nested documents and arrays map 1:1 to BSON types.

What if my top level is a single object?

A single object becomes a one-document insertMany call — no manual wrapping needed.

Why mongosh instead of mongoimport?

insertMany runs in any shell and keeps your data as plain script you can review and version, while mongoimport is a bulk file path. This tool targets the script path.

See category