Sooner or later, JSON data has to move into a database: an app export, a partner feed, a pile of records a developer handed over. The database side of that move almost always starts from a flat file: import tools read a header row as the list of fields and load each following line as one record. Nested JSON does not fit that shape, so the conversion has to happen first, and deliberately.

This guide walks through preparing that file with the free JSON to CSV Converter on Ovatly: what the converter hands you, which decisions stay yours, and what to check before a large import. It stays general on purpose: the import step belongs to your database, not this tool.

Contents

  • Quick answer
  • Why the import wants a flat table
  • What the converter hands you
  • Dotted column names: the rename is your edit
  • Values arrive as written: typing happens at import
  • Empty cells are missing values
  • How to convert for import, step by step
  • Worked example: preparing two customer records
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

To convert JSON to CSV for a database import: paste an array of objects into the JSON to CSV Converter, or upload the .json file, and download converted.csv. The header row of that file becomes the field list at import, nested objects arrive as separate columns with dotted names such as address.city, and values are written exactly as they appear, so typing numbers and dates is the import step's job. Records missing a key leave an empty cell, whose treatment is the importer's setting. The converter runs locally and never connects to your database.

Why the import wants a flat table

A database table is a rectangle: named fields across the top, one row per record, one value per cell. An importer maps the CSV header row onto those field names and reads rows in order. Anything that cannot be expressed as a field name and a plain value has nowhere to go.

JSON, by contrast, is a tree: a record can hold an address object, and that object a city. Before an import can start, the tree must be projected onto the rectangle, and the quality of that projection decides whether the import takes ten minutes or an afternoon of cleanup.

What the converter hands you

The converter takes an array of objects and produces a comma-delimited CSV with standard minimal quoting, so fields containing commas or quotes are wrapped safely. It shows record and column counts before you download: your first check.

Nested objects are flattened into dot-style columns, one column per leaf value. The columns are the union of every key in every record, in first-appearance order. Simple arrays join into one cell with "; ", and arrays of objects are written as JSON text inside the cell, preserved whole. A single object becomes a one-row table; an array of arrays is accepted as rows directly.

Dotted column names: the rename is your edit

Flattening names columns by path, so a city inside an address arrives as address.city. At import, that dotted string is simply the field name the importer sees, and many tables are happy with it.

If yours is not, the fix is simple: edit the CSV header row and rename address.city to city, or whatever your schema expects, before importing. The converter does not rename columns, and that restraint is deliberate: a silent rename could collide two paths into one name and quietly merge their values.

Values arrive as written: typing happens at import

The converter writes values exactly as they appear in the JSON and never reformats them. A price written as 19.99 stays 19.99, a date keeps the format the source used, and text keeps its spelling.

So the CSV is effectively all text, and the typing decision sits with the import step, where it belongs. At import, you or your tool assign each column a type, and values are read as numbers, dates or text accordingly. If a value cannot be read as the type you chose, that surfaces at import time, in the open, rather than hidden by a converter guessing earlier.

Empty cells are missing values

Because the columns are the union of all keys, a record that lacks a key leaves an empty cell in its row. Empty cells are the normal consequence of untidy data, and every importer has an opinion about them: an empty cell might become a null, an empty string, a default, or a rejected row.

Which happens is a setting of your importer, not of the converter, and it is worth deciding before the import rather than discovering afterwards. The converter shows you the gap honestly, as a visible blank, instead of filling it with a guess.

How to convert for import, step by step

  1. Open the JSON to CSV Converter and paste your JSON, or upload the .json file. An array of objects gives one row per record.
  2. Convert and compare the counts against the source. A mismatch here is cheap; the same mismatch after import is not.
  3. Download converted.csv, open it, and rename any dotted headers you need changed, in the header row only.
  4. Check a few rows for unexpected empty cells and decide how your importer treats them.
  5. Run the import with your database's own tool, then verify row counts and spot-check records.

Worked example: preparing two customer records

Suppose the JSON holds two customers, Ana in Lisbon with no age recorded, and Ben in Porto, aged 31:

[
  { "name": "Ana", "address": { "city": "Lisbon" } },
  { "name": "Ben", "address": { "city": "Porto" }, "age": 31 }
]

The converted file reads:

name,address.city,age
Ana,Lisbon,
Ben,Porto,31

Read that as an importer would. The header offers three fields: name, address.city and age. If the target table wants a plain city field, rename the second header first. Ana's empty age cell forces a decision: does it become a null? Ben's age arrives as the text 31 and becomes a number only when the import types that column. Two records in, two rows out, every decision visible.

Limitations and honest tradeoffs

The converter prepares a file; it does not import anything, connect anywhere, or know your schema. It cannot rename columns, choose column types, or decide what an empty cell means; it leaves those decisions to you and your importer on purpose. Arrays of objects stay as JSON text in a cell, which preserves them but gives you no importable fields for their contents. Scalars and mixed arrays are rejected with an explanation, because they have no clear columns. Deeply nested JSON flattens into very wide tables: clean to import, awkward afterwards.

Common mistakes

  • Importing before checking the header row. Dotted names and extra columns are easy to fix in the CSV, painful in a loaded table.
  • Assuming a column is numeric because it looks numeric. It is text until the import step types it.
  • Letting empty cells surprise you. Decide whether they become nulls before the import, not after queries start misbehaving.
  • Expecting the converter to rename or clean fields. It writes values exactly as they appear and keeps names faithful to the source paths.
  • Converting a mixed array and expecting rows. Objects mixed with plain values have no clear columns and are rejected; split the data first.

FAQs

Does the converter connect to my database? No. It runs fully in your browser and produces a CSV file called converted.csv. You download that file and feed it to your database's own import step. Nothing is uploaded and no connection is made.

What happens to columns like address.city? The flattened columns keep their dotted names in the header row, and an importer will typically create fields with those names. If your table expects plain names, rename the headers in the CSV before importing. The converter does not rename columns.

Will numbers and dates be typed correctly? The converter writes values exactly as they appear in the JSON and never reformats them. Any conversion from text to a number or date type happens in your database's import step, where you control the column types.

How are missing values handled? A key that a record does not have becomes an empty cell in its row. Whether that empty cell imports as a null, an empty string or a rejected row is a setting of your importer, so check it before a large import.

What JSON shapes will the converter refuse? It needs an array of objects, a single object, or an array of arrays. A list of plain scalars or a mixed array has no clear columns, so it is rejected with an explanation rather than converted into a broken table.

Conclusion

A good import is decided before it runs: a flat file whose header row you have read, dotted columns renamed where your schema needs it, empty cells accounted for, and typing left to the import step. The JSON to CSV Converter produces that file locally and faithfully. For the full picture of how nesting is handled, read what happens to nested objects when you convert JSON to CSV, and browse the Data and JSON Tools guides for more.

References