Format JSON for MongoDB Import Online Free
Overview
MongoDB's mongoimport tool expects NDJSON (Newline Delimited JSON): one document per line, no surrounding array brackets. If your source is a standard JSON array, you need to convert it before importing. This tool does the conversion and validates each document for valid JSON syntax.
How to Use This Tool
Paste your JSON array. Click Convert to NDJSON. The tool outputs one JSON object per line. Save the output as a .ndjson file and run: mongoimport --db mydb --collection mycoll --file data.ndjson
Ready to get started? It's free, no registration required, and your files never leave your device.
PDF Tool →Frequently Asked Questions
What is NDJSON and how is it different from JSON?
NDJSON (Newline Delimited JSON) has one complete JSON object per line with no commas between objects and no surrounding array brackets. Standard JSON wraps all objects in an array. MongoDB's mongoimport requires NDJSON format.
Can I use mongoimport with a standard JSON array?
Yes, with the --jsonArray flag: mongoimport --jsonArray --db mydb --collection mycoll --file data.json. However, NDJSON is preferred for large imports because it streams line by line without loading the full file into memory.
How many documents can I import with mongoimport?
mongoimport handles millions of documents. For large imports (1M+ documents), split the NDJSON into files of 100,000 lines each and import in parallel for better throughput.