Irreva logo
Explore Irreva
DeveloperMarch 3, 2026· 5 min read· Updated June 10, 2026

How to Convert JSON to CSV Online Free

Hasanur Rahman

Written by Hasanur Rahman

Founder & Full-Stack Developer · Irreva · Rangpur, Bangladesh

JSON is what code works with; CSV is what spreadsheets and data analysts work with. Converting an API response or data export from JSON to CSV lets you open the data in Excel, Google Sheets, or any data tool without writing a line of code. This guide explains how the conversion works and how to handle the tricky cases.

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.

Frequently Asked Questions

Does JSON to CSV work with any JSON structure?

It works best with a JSON array of flat objects. Nested objects require flattening, deeply nested or irregular structures may need manual cleanup before converting. The tool handles common flat and one-level-nested structures automatically.

Can I choose which JSON fields appear as CSV columns?

Online tools typically include all keys from the first object. For custom column selection, a short script in Python (pandas) or JavaScript gives you full control.

What if different objects in the array have different keys?

Most converters use the union of all keys as the header, and leave cells empty for objects that don't have a particular key. The Irreva converter follows this approach for maximum completeness.

Why do some fields show as [object Object] in the CSV?

This happens when a field contains a nested object and the converter stringifies it without flattening it. It means those fields need to be either excluded or flattened before converting. Use JSON Formatter to inspect the structure and identify nested fields.

Can I use the output CSV directly in a database import?

Yes. Most databases and ORMs support CSV import. Make sure the column types match what your database expects — numbers, dates, and booleans may need the correct format for your specific database.

Hasanur Rahman

About the author

Hasanur Rahman

Founder & Full-Stack Developer · Irreva · Rangpur, Bangladesh

Hasanur Rahman is the founder of Irreva and a full-stack developer based in Rangpur, Bangladesh. He builds all of Irreva's tools with a focus on privacy-first, browser-based processing.