Convert MongoDB JSON to SQL
Translate MongoDB documents into relational rows, mapping nested fields to columns so a collection can be loaded into a SQL table.
How to use
- Paste the MongoDB documents.
- Review how nested fields map to columns.
- Copy the SQL output.
Frequently asked questions
How do nested documents become columns?
They are flattened into dotted or underscored column names, since a relational table has no nested type. Deeply nested data usually wants its own table instead.
What happens to arrays?
There is no clean single-table answer. Short arrays can be serialised into one column; anything you need to query belongs in a child table with a foreign key.
What about documents with different fields?
That is the real difficulty in this migration. The union of all fields becomes the column list, and documents missing a field get NULL.
Does it handle ObjectId and dates?
ObjectId becomes a string column and BSON dates become SQL timestamps, which are the mappings almost every migration ends up choosing.
Last updated
Powered by maratool