JSON to CSV Converter
Convert JSON arrays to CSV with proper escaping — download as .csv
How to Use the JSON to CSV Converter
- Paste a JSON array of objects.
- Click Convert to CSV.
- Copy or download the CSV output.
Automatically extracts all unique keys as column headers. Handles special characters, commas, and quotes in values.
What is JSON to CSV Conversion?
The JSON to CSV Converter transforms arrays of JSON objects into tabular Comma-Separated Values (CSV) format. It automatically infers table headers from object keys, handles nested objects using dot-notation, escapes strings containing commas or quotes according to RFC 4180, and provides instant download for Microsoft Excel and Google Sheets.
Common Uses
- Exporting database query results and API response arrays into Excel spreadsheets
- Converting telemetry, logging, and metrics JSON streams into tabular business reports
- Preparing machine learning and analytics datasets for ingestion into pandas or R
- Migrating data from NoSQL document databases into relational databases
Frequently Asked Questions
How does the converter handle nested JSON objects and arrays?
Nested objects are flattened using clean dot-notation (e.g. `user.address.city`), while arrays are formatted as serialized strings or semicolon-separated lists to preserve tabular integrity.
What happens if different JSON objects in the array have different keys?
The converter scans all objects in the input to assemble a comprehensive union of all unique keys, inserting empty values where specific objects lack particular attributes.
Are special characters and commas escaped properly?
Yes. Following standard RFC 4180 rules, any cell containing commas, quotes, or line breaks is properly enclosed in double quotes with internal quotes escaped.
Notes from this implementation
Objects in, columns out
An array of objects becomes a header row taken from the keys, then one row per object. Nested objects do not have a column. Flatten them before you convert, or the cell will be a JSON blob or empty, depending on the branch in this script. Keys that appear only on later rows still need a column; a converter that looks only at the first object will drop them.
Commas, quotes, and newlines inside a value have to be quoted in the CSV. If you open the result in a spreadsheet and a single field splits in two, the quoting step did not run on that value. The reverse tool, CSV to JSON, is the check: convert back and see if the field survived.