JSON to CSV
Convert JSON arrays to CSV.
About this tool
Paste a JSON array of objects and get CSV back, with the keys of the first object as the header row. Values that contain commas or quotes are wrapped and escaped for you. Conversion runs in your browser.
How to use
How it works
The tool parses the JSON, wraps a single object in an array if needed, and writes one CSV row per object using Papa Parse. The header row is taken from the keys of the first object, so keys that only appear in later objects are dropped. Cells containing commas, quotes or line breaks are quoted and inner quotes are doubled, as RFC 4180 expects.
Worked example
Two records to CSV
- Input
- [{"id":1,"name":"Ada","role":"admin"},{"id":2,"name":"Lin","role":"editor"}]
- Output
- id,name,role 1,Ada,admin 2,Lin,editor
- Walkthrough
- The keys id, name and role become the header, and each object becomes one row in key order.
Limitations
- Columns come from the first object only. If a later object has an extra key, that value is lost; put the full set of keys in the first record.
- Nested objects and arrays are not flattened. Each one is written into its cell as JSON text, so flatten the data first if you need separate columns.
- An array of plain values such as [1,2] gives a single "value" column.
- Invalid JSON stops with an error that points at the line and column.
Questions
How do I convert JSON to CSV?
Why are some of my JSON keys missing from the CSV?
What happens to nested JSON objects?
Can I convert a single JSON object?
Features
- First-object header row
- Quotes and commas escaped
- Single object or array
- Runs in your browser
Guides
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
SQL Tutorial - Full Database Course
freeCodeCamp.org
JSON often lands next to SQL exports when debugging data pipelines.
Watch on YouTubeLearn JSON - Full Crash Course for Beginners
freeCodeCamp.org
Solid JSON syntax and nesting basics for formatter and validator tools.
Watch on YouTube
- Getting started with JSON Schema
JSON Schema
When you outgrow ad-hoc validation and need a schema definition.
- MDN Web Docs
MDN
Primary reference for web APIs these developer tools touch.