Convert CSV to JSON

Turn a spreadsheet table into an array of JSON objects keyed by the header row

The tool loads here. It needs JavaScript, because the work happens on your device.

Your files and your privacy

The table is converted inside this browser tab and the JSON is produced by your own device. There is no upload endpoint, the page’s Content-Security-Policy limits connect-src to this origin, and Clear data discards both the table and the generated JSON.

What this tool does

Convert a CSV table into JSON: one object per data row, keyed by the header names, written as a top-level array. Blank header names become positional keys and repeated names are suffixed rather than overwriting each other. The conversion runs the other way too.

Conversion turns each data row into one JSON object, using the header row for the keys, and writes the table as a top-level array indented with two spaces. A blank header cell becomes a positional key such as column_3, and a name that appears twice takes a numeric suffix so the second column keeps its data instead of overwriting the first. Every value is written as a string, because a CSV file carries no type information to convert from.

How to use it

  1. Select Choose a CSV or JSON file and load your table, or paste the rows straight in.
  2. Check that the first row really is the header: its names become the keys exactly as written, spaces and capitals included.
  3. Deal with any ragged-row warning first, because cells beyond the last header column have no key and do not reach the JSON.
  4. Select Download JSON, or Copy JSON to paste it elsewhere. Download CSV is there too, for when you only wanted the table tidied.

Example use cases

Supported input and output

Accepts

Produces

What this tool will not do

Common mistakes

Technical notes

The CSV parse runs in a Web Worker using a hand-written RFC 4180 state machine, so quoted delimiters and newlines inside quoted fields are resolved before conversion begins. Keys are computed once from the header and each row is mapped by position, so a missing cell becomes an empty string rather than an absent key and every object carries the same key set. The reverse direction builds the columns from the union of keys across all objects in first-seen order.

Frequently asked questions

Are numbers converted to JSON numbers?
No. Every value is written as a string, because a CSV file has no type information and guessing is how converters turn a product code such as 0012 into the number 12. Cast the values in whatever reads the JSON.
What happens to a column with no header name?
It gets a key based on its column number, so a third column with a blank header becomes column_3. The data is kept and only the name is invented, so rename the column first if you want a real key.
Can I convert JSON back to CSV?
Yes. Load a .json file containing a top-level array of objects and it becomes a table. The columns are the union of keys across every object in first-seen order, and a nested value is written into the cell as JSON text.