CSV to JSON and JSON to CSV Converter – Free

Paste CSV with a header row to get a JSON array of objects, or paste a JSON array to get CSV. This CSV to JSON converter runs locally and lets you download the result.

How to use the CSV ↔ JSON tool

  1. Under Source format, choose CSV to produce JSON, or JSON to produce CSV.
  2. Paste your data into the CSV or JSON box. CSV needs a header line; JSON needs an array of objects.
  3. Select Convert, or select Example to load a three-line CSV sample.
  4. Review the output in the Result box and select Copy, or use the Download link to save data.json or data.csv.

How the CSV to JSON conversion works

The first row supplies the property names. Every later row becomes one object whose keys are those names and whose values are the cells in the same positions. Output is pretty-printed with two-space indentation.

The parser follows the quoting rules of RFC 4180. A field wrapped in double quotes may contain commas and line breaks, and a doubled quote inside it stands for one literal quote. A byte order mark at the start is removed, and Windows, Unix and old Mac line endings are all accepted. Every value stays a string: the tool does not guess that 42 is a number or that true is a boolean, so leading zeros in ZIP codes and IDs survive.

Worked example with quoted fields

The CSV below has a comma inside a name, quotes inside a note and an empty last cell. In the JSON, the comma stays part of the name, the doubled quotes become single escaped ones, the empty cell becomes an empty string, and the id values remain strings.

id,name,note
1,"Smith, Ann","She said ""hi"""
2,Bob,

[
  {
    "id": "1",
    "name": "Smith, Ann",
    "note": "She said \"hi\""
  },
  {
    "id": "2",
    "name": "Bob",
    "note": ""
  }
]

Going from JSON to CSV

With Source format set to JSON, the input must be an array whose items are all objects. The header row is the union of every key in order of first appearance, so objects with different shapes still fit one table. A key that an object lacks, or a null value, produces an empty cell.

Nested arrays and objects are written into the cell as JSON text. Cells that contain a comma, a quote or a line break are quoted, with inner quotes doubled. Rows are joined with CRLF as RFC 4180 specifies, and there is no line break after the last row.

[{"id":1,"tags":["a","b"]},{"id":2,"email":null}]

id,tags,email
1,"[""a"",""b""]",
2,,

Error messages and what causes them

The converter stops on malformed input and shows the reason under the Result box.

  • CSV needs a header row with unique, nonempty names: the input is empty, two columns share a name, or a header cell is blank. A trailing comma on the header line causes this.
  • Every CSV row must match the number of columns in the header: a row has too few or too many cells. A blank line in the middle of a multi-column file triggers it too.
  • A CSV field contains unexpected characters after a quote: a quote appears mid-field, or text follows a closing quote.
  • A quoted CSV field is missing its closing quote: an opening quote was never closed.
  • Enter an array of JSON objects: the JSON is a single object, an array of numbers or strings, or an array that contains null.
  • Other messages in JSON mode come from the browser's JSON parser and point to invalid syntax.

Frequently asked questions

Can it convert semicolon- or tab-separated files?

No. The comma is the only delimiter. A semicolon- or tab-separated file is read as one wide column, so each row becomes an object with a single key. Replace the delimiter with commas first.

Why are numbers in my JSON output wrapped in quotes?

CSV has no data types, and the tool does not infer them. Every cell becomes a JSON string, which protects values such as 00501 or 1e5 from being changed.

Are spaces around values trimmed?

No. Spaces are kept exactly as typed, in headers and in cells. A header line written as name, email produces a second key with a leading space.

Is there a size limit, and is my data uploaded?

The code sets no size limit, so the ceiling is your browser's memory. Parsing runs in the page and the Download link is built from a local blob, so the data is not sent to a server.

Related tools