Skip to tool

CSV ↔ JSON Converter

Input
Output

The converted JSON or CSV

Off keeps leading zeros and long IDs as strings.

Convert CSV to JSON and JSON to CSV

Paste text or drop a .csv, .tsv, .json, .jsonl or .ndjson file up to 10 MB. Pick CSV → JSON or JSON → CSV with the tabs; a dropped file selects the direction from its extension. With the Auto delimiter, the tool reads the first line and picks the comma, semicolon, tab or pipe that occurs most. Text input is capped at 1,000,000 characters. Copy the result or download it as .csv, .json or .jsonl.

How to convert CSV to JSON or JSON to CSV online

  1. Choose CSV → JSON or JSON → CSV. A dropped .jsonl or .ndjson file also sets Source shape to NDJSON / JSONL.
  2. For CSV → JSON, leave Delimiter on Auto unless the columns come out wrong, then set First row is header, Trim whitespace, Infer types and the output format: Pretty, Minify or NDJSON.
  3. For JSON → CSV, set Source shape to match the input, then pick how nested values are written, the delimiter and the line ending. Auto is not offered here; the delimiter is a comma until you change it.
  4. Check the chip beside Output. It reads Converted, Converted with warnings, or Error; during an error the last valid output stays on screen, dimmed.
  5. Copy the result or download it as converted.csv, converted.json or converted.jsonl. The options are stored in the page address, so a bookmark reopens the tool with the same settings.

CSV to JSON

Pick the delimiter (comma, semicolon, tab, pipe or any single character) and whether the first row is a header. With a header row, each line becomes an object keyed by the column names; without one, you get an array of arrays. Output can be pretty-printed with 2-space indentation, minified, or written as NDJSON with one object per line. Values stay strings unless you turn on type inference, which converts 42 and -3.5 to numbers, true and false to booleans, and null to null.

JSON to CSV

The input must be a JSON array of objects, an array of arrays, or NDJSON. Columns are the union of all object keys in the order they first appear, and missing keys become empty cells. Nested objects are flattened with dot paths by default, so {"address": {"city": "Paris"}} becomes an address.city column; arrays are written as JSON text in one cell. Choose LF or CRLF line endings and whether to quote every field.

RFC 4180 quoting rules

Both directions follow RFC 4180. A field that contains the delimiter, a double quote, or a line break is wrapped in double quotes, and a quote inside it is written twice: the value say "hi" becomes "say ""hi""". Quoted fields can span several lines, empty trailing fields are kept, and an unclosed quote is reported as an error.

CSV and JSON conversion examples

  • Header id,name,active with the row 007,Ada,true → [{"id":"007","name":"Ada","active":"true"}]. With Infer types on, active becomes true and 007 stays "007".
  • With Infer types on: 1e3 → 1000, +5 → 5, .5 → 0.5, TRUE → true, NULL → null. The quoted field "1,024.00", the value 0x10 and an empty cell stay strings.
  • Header name;price with the row Tee;12,50 → [{"name":"Tee","price":"12,50"}]. Auto picks the semicolon, and the decimal comma keeps 12,50 a string even with Infer types on.
  • Header "Last, First";Age with the row "Lovelace, Ada";36 → [{"Last, First":"Lovelace, Ada","Age":"36"}]. Delimiter detection skips the commas inside quotes.
  • [{"id":1,"user":{"name":"Ada","langs":["en","fr"]},"note":null}] → header id,user.name,user.langs,note and the row 1,Ada,"[""en"",""fr""]", — the trailing comma is the empty cell for null.

What is lost in a CSV round trip

CSV stores text only and has no nesting, so JSON converted to CSV and back is not the JSON you started with. Numbers and booleans return as strings unless Infer types is on. null is written as an empty cell and returns as an empty string, not null, with or without inference. Dot-path columns are not folded back into objects: user.name returns as a key literally named user.name, and an array cell returns as the string ["en","fr"]. Numbers are written the way JavaScript prints them, so 1.50 becomes 1.5, and an integer above 2^53 such as 12345678901234567890 becomes 12345678901234567000.

Common CSV and JSON conversion mistakes

  • Leaving a thousands separator unquoted. Under the header item,price, the row Keyboard,1,024.00 gives price "1" and an extra key _extra_1 "024.00", with a warning that names the row. Write the value as "1,024.00".
  • Putting a space between the delimiter and an opening quote. Ada, "likes tea, no milk" is rejected with the error Line 2, column 6: unexpected character. A quote can only open a field at its first character, and Trim whitespace runs after parsing. A bare inch mark does the same, so write 27" monitor as "27"" monitor".
  • Repeating a column name. Header id,name,name with the row 1,Ada,Lovelace gives {"id":"1","name":"Lovelace"}: the later column overwrites the earlier one. Rename one of them, or turn off First row is header.
  • Blank lines inside a CSV. Each one becomes a record with every field empty.
  • Keys that contain a dot. In [{"a.b":1,"a":{"b":2}}] both values map to the column a.b and only 2 is written. Switch Nested values to Keep as JSON strings.

FAQ

Will type inference break IDs and ZIP codes?

No. Even with inference on, values with a leading zero such as 0731 or 00123 and integers longer than 15 digits stay strings, because converting them to numbers would lose digits. Inference is off by default, so every value is a string unless you enable it.

How are nested JSON objects represented in CSV?

Either flattened into dot-path columns (address.city, address.zip) or kept as a JSON string in a single column. Pick the one that matches what your spreadsheet or import tool expects.

Why do I get an error for a single JSON object?

JSON to CSV needs an array at the top level, since each element becomes a row. Wrap a single object in square brackets, as in ['{"name": "Alice"}'], or switch the source to NDJSON if you have one object per line.

Is NDJSON (JSON Lines) supported?

Yes. Set the JSON source to NDJSON / JSONL when each line is its own JSON object, or pick NDJSON as the output mode to write one object per line. Blank lines are skipped, and an invalid line is reported by number.

Why does Excel show garbled characters in the downloaded CSV?

The file is saved as UTF-8 without a byte order mark, and some Excel versions then open it in a legacy encoding, which breaks accented and CJK characters. Import it with Data > From Text/CSV and choose UTF-8 instead of double-clicking the file. In locales that use a comma as the decimal separator, Excel also expects semicolon-delimited CSV.

How do I convert an Excel sheet to JSON?

Copy the cells in Excel and paste them here: Excel copies them as tab-separated text, which the Auto delimiter detects. You can also save the sheet as CSV UTF-8 and drop the file. Either way you get the values as Excel displays them, not the formulas, and only one sheet at a time.