CSV to JSON Converter
Turn CSV rows into a JSON array of objects, or flatten JSON back into CSV — quoted commas and all.
[
{
"name": "Ada",
"role": "Engineer",
"quote": "Loves math, logic"
},
{
"name": "Grace",
"role": "Admiral",
"quote": "Says \"hello world\""
}
]This converter goes both ways. CSV → JSON reads the header row as keys and turns each following row into an object, so name,role over Ada,Engineer becomes [{ “name”: “Ada”, “role”: “Engineer” }]. JSON → CSV reverses it: object keys become the header row and each object becomes one line.
What CSV and JSON are for
CSV (comma-separated values) is a flat, spreadsheet-friendly table: one line per row, fields split by commas, and usually a header row naming the columns. JSON (JavaScript Object Notation) is the structured format that APIs and code prefer, where an array of objects maps each column name to a value. Converting between them lets you move data from a spreadsheet export into an application, or turn an API response into something you can open in Excel or Google Sheets.
How the conversion works
Going CSV → JSON, the first line is treated as the header and its cells become the object keys; every later line becomes one object, matching each cell to the key in the same position. Going JSON → CSV, the converter scans every object to build the union of all keys as the header row, then writes each object as a line, filling in an empty cell where a key is missing. Fields that contain a comma, a quote, or a line break are wrapped in double quotes, and any quote inside is doubled so nothing breaks the columns.
- 1 Keep CSV → JSON selected. The default direction reads CSV and outputs a JSON array.
- 2 Paste your CSV with a header row. For example name,role on the first line, then Ada,Engineer below it.
- 3 Let the header become keys. name and role turn into the keys of every object in the array.
- 4 Check quoted fields. A cell like "Loves math, logic" keeps its comma because it is wrapped in quotes.
- 5 Copy the JSON. The output is a pretty-printed array: [{ “name”: “Ada”, “role”: “Engineer” }]. Use Copy to grab it.
CSV formatting rules
The conventions this converter follows when reading and writing CSV.
| Rule | What it means |
|---|---|
| Header row | The first line names the columns; those names become the JSON keys. |
| Comma separates fields | Each unquoted comma starts a new field on the row. |
| Quote fields with commas | Wrap a field in double quotes when it contains a comma, so it stays one cell. |
| Quote fields with line breaks | A field holding a newline must be quoted so the row is not split early. |
| “” escapes a quote | Inside a quoted field, two double quotes stand for one literal double quote. |
When to use each direction
Use CSV → JSON when you have a spreadsheet or database export and need structured data for code, a config file, or an API request. Use JSON → CSV when an API or app hands you a JSON array and you want to open it in a spreadsheet, share it with non-developers, or import it somewhere that only accepts CSV. Both directions assume a single header row: CSV → JSON needs one to name the keys, and JSON → CSV writes one from the object keys. If your objects have different sets of keys, JSON → CSV merges them all into the header so no column is lost.