JSON to CSV
Convert JSON arrays to CSV format instantly β paste your JSON, click Convert, and copy the result.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based data format used almost universally in web APIs, configuration files, and data exchange between applications. A JSON value can be a string, number, boolean, null, object (keyβvalue pairs enclosed in curly braces), or array (ordered list enclosed in square brackets). JSON supports nesting: an object can contain arrays of other objects, making it ideal for hierarchical data.
// Example: valid JSON array of objects
[
{ "name": "Alice", "age": 30, "city": "Amsterdam" },
{ "name": "Bob", "age": 25, "city": "Rotterdam" }
]What is CSV?
CSV (Comma-Separated Values) is the simplest tabular data format: each row is a line of text, each column is separated by a comma, and the first row typically contains column headers. CSV has no official standard for all edge cases, but RFC 4180 is the de facto specification most tools follow.
// Same data as CSV (RFC 4180 format)
name,age,city
Alice,30,Amsterdam
Bob,25,RotterdamCSV is supported natively by Microsoft Excel, Google Sheets, LibreOffice Calc, most BI tools (Tableau, Power BI, Looker), SQL import utilities, and virtually every data science library (pandas, R, MATLAB). It is the lowest-common-denominator format for data exchange between systems.
JSON vs. CSV: when to use each
| Feature | JSON | CSV |
|---|---|---|
| Data structure | Hierarchical (nested objects/arrays) | Flat (two-dimensional table only) |
| Human readability | Readable but verbose for large datasets | Very readable for simple tabular data |
| Spreadsheet support | Requires import plugin or conversion | Opens directly in Excel / Sheets |
| Nested data | Supported natively | Not supported β must be flattened |
| Data types | Strings, numbers, booleans, null, arrays, objects | All values are plain text strings |
| File size | Larger due to key names repeated per object | Compact β headers appear only once |
| Best for | APIs, config files, complex data | Spreadsheets, BI tools, SQL imports |
How JSON-to-CSV conversion works
Converting a JSON array of objects to CSV requires two steps: extracting the column headers from the keys of the first object, then writing each subsequent object as a row in the same column order. Any value that contains a comma, a double-quote, or a newline must be enclosed in double-quotes, with internal double-quotes escaped as two consecutive double-quotes ("").
Input JSON:
[{ "product": "Widget, Pro", "price": 9.99 }]
Output CSV (RFC 4180):
product,price
"Widget, Pro",9.99
β The comma inside the value requires wrapping in quotesLimitations: what this tool cannot convert
CSV is inherently flat. If your JSON contains nested objects or arrays, they cannot be represented directly in CSV without additional decisions about how to flatten them. This converter handles the common case β a JSON array of flat objects β and will produce an empty or partial result for deeply nested structures.
// This flat JSON converts cleanly:
[{ "name": "Alice", "score": 95 }]
// This nested JSON does NOT convert cleanly:
[{ "name": "Alice", "scores": [95, 88, 72] }]
// The "scores" array has no direct CSV representationFor nested JSON, you have three options: flatten the data manually before converting, serialize the nested values as strings (e.g. JSON-stringify the inner array), or use a dedicated ETL tool that supports custom flattening logic.
Common use cases
Tips for clean conversions
- Ensure consistent keys across all objects. If some objects have extra fields that others lack, the missing columns will be empty in the output. Normalise your JSON so every object has the same keys before converting.
- Validate your JSON first. A common mistake is exporting JSON with trailing commas or single-quoted strings β both are invalid in standard JSON but allowed in JavaScript. Use a JSON validator to confirm your input is spec-compliant before converting.
- Watch for special characters in values. Commas, newlines, and double-quotes inside values are automatically escaped by this tool per RFC 4180. If you open the CSV in a text editor and see quotes around some values, that is correct escaping β not an error.
- Large datasets: consider streaming tools. This browser-based converter handles thousands of rows comfortably. For millions of records, use a command-line tool (jq, csvkit) or a server-side script to avoid memory limitations.
Frequently asked questions
What does this tool do?
It converts JSON data β typically an array of objects β into CSV format with a header row, ready to open in Excel, Google Sheets or any spreadsheet.
Is my data uploaded to a server?
No. The conversion runs entirely in your browser, so your JSON stays private on your device.
How are nested JSON objects handled?
Flat objects map cleanly to columns. Deeply nested structures may need flattening first, since CSV is a two-dimensional format without nesting.
What if my JSON objects have different keys?
The converter builds columns from the keys it finds; rows missing a key get an empty cell for that column.
Takes a JSON array of objects and converts each object to a CSV row. The first row contains the column headers from the object keys. Values with commas or quotes are automatically escaped per RFC 4180.