How to use the converter
- Choose the direction: JSON → CSV or CSV → JSON.
- Paste your data or press Sample.
- Pick a delimiter. For CSV input, Detect automatically usually gets it right.
- Set the options: flatten nested objects (JSON → CSV), or header row, type detection and rebuilding nesting (CSV → JSON).
- Check the table preview, then copy or download
data.csvordata.json.
How the conversion works
JSON → CSV. The input should be an array of objects (a single object becomes one row, and an array of arrays is written as rows directly). Every object is flattened, and the columns are the union of all keys in order of first appearance, so objects with missing fields simply get empty cells. Each field is quoted only when needed: if it contains the delimiter, a double quote (doubled as ""), a line break, or leading or trailing spaces. Lines end with CRLF, as RFC 4180 specifies.
CSV → JSON. The parser handles quoted fields, escaped quotes and line breaks inside quotes, so addresses and notes spanning several lines stay in one field. The first row provides keys (or column1, column2… without a header). Rows with too few or too many fields are reported.
Worked examples
Example 1: exporting users for a spreadsheet
Load the JSON sample: three users with nested addresses. The CSV has the columns id, name, email, address.city, address.country, active, notes. The note containing quotes and a comma is wrapped in quotes with inner quotes doubled, exactly as Excel and Google Sheets expect.
Example 2: a German spreadsheet export
Paste a CSV that uses semicolons, such as Name;Stadt;Umsatz. Automatic detection picks the semicolon, and the JSON keys come from the header row. A check tells you which delimiter was detected.
Example 3: rebuilding nested data
Convert the CSV sample with rebuild nesting on. The columns address.city and address.country become "address": {"city": …, "country": …}, so the JSON matches the shape an API expects.
Choosing the right options
- Keep type detection on for numbers and booleans, but turn it off when every value must stay text (product codes, phone numbers).
- Turn flattening off only if your objects are already flat.
- Add the BOM only for Excel; other tools don’t need it, and some command-line tools show it as a stray character.
Common mistakes
- Pasting JSON Lines (one object per line, no brackets). Wrap the lines in
[ ]and add commas first. - Opening a CSV by double-clicking in Excel when it uses a different delimiter from your region’s default. Use Excel’s import dialog, or export with the matching delimiter.
- Leading zeros lost in spreadsheets. The CSV keeps them; it’s the spreadsheet that converts
02134to a number. Import that column as text. - Inconsistent objects. Different keys in each object create many sparse columns. Normalise the data first.