How JSON to CSV conversion works
Converting a JSON array to CSV works by taking the keys of the first object in the array as the CSV header row, then outputting each object's values as a row. A JSON array of ten user objects produces a CSV with a header row and ten data rows.
The key requirement for a clean conversion is that the JSON must be an array of flat objects — objects that contain only primitive values (strings, numbers, booleans), not nested objects or arrays. Most API response data and data exports fit this shape.
The Irreva JSON to CSV converter accepts a JSON array, extracts the keys automatically for the header, and produces a downloadable CSV file. You can also copy the CSV text directly.
Handling nested JSON
Nested JSON — objects that contain other objects or arrays — doesn't map directly to flat CSV columns. There are two common approaches: flatten the nested keys (address.city becomes a column named 'address.city'), or only include top-level primitive values and ignore the nested data.
For API responses that have one or two levels of nesting, flattening is usually the right approach. For deeply nested data, you may need to pre-process the JSON to extract just the fields you need before converting.
If your JSON contains an array field (like a user's list of tags), flattening requires a strategy: join the array values into a delimited string, repeat the parent row for each array item, or ignore the array field.
- Flat objects: straightforward, one-to-one conversion
- Nested objects: flatten keys or select specific fields
- Array fields: join as string, expand rows, or exclude
- Mixed types: most converters coerce values to strings
Opening the CSV in Excel and Google Sheets
A CSV file from the converter will open directly in Google Sheets by uploading it, or in Excel by using File > Open. Google Sheets also lets you import CSV via File > Import and configure the delimiter if needed.
If your data contains international characters (accented letters, Chinese, Arabic), make sure the file is saved as UTF-8. Both Excel and Google Sheets handle UTF-8 CSV well. Older Excel versions on Windows may default to the system encoding, which can corrupt non-ASCII characters — look for the UTF-8 import option if you see garbled characters.
Numbers that look like IDs or zip codes may be automatically formatted as numbers by Excel, dropping leading zeros. Wrap those fields in double quotes in the CSV or format the column as text in Excel after importing.
