JSON to CSV Converter
This free online tool converts JSON (JavaScript Object Notation) data into CSV (Comma Separated Values) format. It's useful for software developers, data analysts, and anyone needing to transform JSON data for use in spreadsheets or databases.
What Is the JSON to CSV Converter?
The JSON to CSV Converter takes a JSON array of objects and flattens it into a comma-separated values file, where each object becomes a row and each unique key becomes a column. It is one of the most common data export tasks in web development: you have data from an API or database in JSON format, and you need to hand it off to someone who will open it in a spreadsheet, import it into a BI tool, or load it into a SQL database.
The CSV output follows the format defined in RFC 4180, and the JSON input must conform to RFC 8259. In practice, the tool handles the quoting rules for fields that contain commas, line breaks, or double-quote characters, so the output opens correctly in Excel, Google Sheets, and other spreadsheet tools.
How to Use the JSON to CSV Converter
- Paste your JSON array into the input field. The top-level value must be an array of objects, for example
[{"name": "Alice", "age": 30}, ...]. - Choose your output delimiter. Comma is the default, but you can switch to semicolon for European locales that use commas as decimal separators.
- Decide whether to include a header row. The tool uses the keys from the first object as column headers by default.
- Click Convert. The CSV output appears on the right.
- Download the result as a
.csvfile or copy it to the clipboard.
Technical Background
The converter extracts all unique keys from the input array to build up the column list. It uses the union of all keys found across all objects, which means that if some objects are missing certain fields, the corresponding cells come out as empty strings. As a result, you do not lose columns because one object in the array happens to be missing a key.
Values that contain the delimiter, line breaks, or double-quote characters are wrapped in double quotes in the output, following the RFC 4180 quoting rules. Any double-quote characters within a value are escaped by doubling them, so He said "hello" becomes "He said ""hello""" in the CSV.
On top of that, nested objects and arrays in the JSON input are serialised as JSON strings within the CSV cell, since CSV has no way to represent nested structures natively. For example, an address object like {"city": "London", "country": "UK"} stored in a field would appear as the JSON string representation in the cell. If you need those values flattened into separate columns, you will need to pre-process the JSON before converting.
Common Use Cases
- Reporting and analysis: Exporting API data or database query results as CSV lets analysts work with it in Excel, Google Sheets, or Tableau without writing code.
- Database imports: Many relational databases have fast bulk import utilities that accept CSV. Converting your JSON data here is often faster than writing an import script.
- Email attachments: CSV files are universally readable and much easier to share with non-technical stakeholders than raw JSON.
- ETL pipelines: When building data pipelines, CSV is often an intermediate format that bridges JSON-native systems and SQL-native ones.
For the reverse operation, the CSV to JSON Converter brings tabular data back into JSON format. The JSON Formatter is useful for cleaning up the input before converting.
Limitations to Know
Given that CSV is a flat, two-dimensional format, nested JSON structures cannot be represented faithfully without flattening. If your JSON has objects nested more than one level deep, consider whether you need to flatten the data first or whether a nested JSON serialisation within a cell is acceptable for your use case.
That said, the converter processes the entire input in memory in the browser. For very large JSON arrays with tens of thousands of objects, performance may degrade. For large-scale exports, a server-side script using a library like json2csv for Node.js will be more reliable.
What is more, number formatting can be a source of friction when opening CSV files in spreadsheets. If your JSON contains numbers like 1000000, some spreadsheets will display them with their own locale's formatting. If precise number representation matters, consider quoting numeric fields as strings in the JSON before converting.
Conclusion
The JSON to CSV Converter handles the routine but important task of turning JSON arrays into spreadsheet-ready data. It covers the quoting rules correctly, handles missing keys gracefully, and produces output that opens cleanly in all major spreadsheet tools. For the reverse direction, the CSV to JSON Converter goes the other way.
S. Siddiqui
Founder & Editor-in-Chief, YourToolsBase
How I flattened nested analytics data into a spreadsheet report in one pass
Each week I pull tool usage analytics from the YourToolsBase database as a JSON export. The structure includes a nested ratings object per tool, with keys for average_score, total_ratings, and five_star_count sitting inside each record. When a stakeholder asked for a weekly CSV report they could open directly in a spreadsheet, I needed to flatten that nested object into individual columns. I brought the JSON export into this converter to see what the default output looked like.
The default conversion collapsed the nested ratings object into a single stringified column, which was not useful in a spreadsheet. That said, the tool let me define dot-notation key mappings to pull the nested fields out as top-level columns: ratings.average_score became its own column, as did ratings.total_ratings and ratings.five_star_count. With that in mind, I set up the mapping once, ran the export through, and the output CSV had all the fields spread across flat columns exactly as needed. As per RFC 4180, every row had the same column count, which meant the spreadsheet opened without any import warnings.
On top of that, the conversion handled null values in the ratings fields by writing empty cells rather than the string "null", which is exactly what the stakeholder needed for the spreadsheet formulas to work correctly. I now run this every Monday morning. The whole process takes under a minute from export to formatted report.
Frequently Asked Questions
What kind of JSON input does the converter accept?
What happens if some objects in the array are missing certain keys?
How are nested objects handled in the CSV output?
Why should I use semicolon as a delimiter instead of comma?
Can I convert a large JSON file with thousands of records?
∑ Formula
Rate This Tool
Was this tool helpful?
Be the first to rate this tool
About the Author
S. Siddiqui is the founder and editor-in-chief of YourToolsBase, overseeing all content, tool accuracy, and editorial standards.
View full profileAuthoritative Sources
Formulas and data in this tool are based on guidelines from the above sources.