Choose language

JSON to CSV Converter

Convert JSON arrays of objects into spreadsheet-ready CSV. Auto-detects headers, flattens nested objects with dot notation, and escapes special characters.

Mehmet Demiray Published Updated
Share
Character that separates values in the output
Write a first row with the column names
Wrap every value in quotes, even when not required

What JSON to CSV Conversion Means

JSON and CSV describe the same data in very different shapes. JSON stores records as objects with named keys, supports nesting, and keeps types like numbers, booleans, and null. CSV is a flat grid: one header row, then one line per record, with values separated by commas. Converting from JSON to CSV means taking an array of objects and laying each object out as a row, with the keys becoming column headers.

The usual trigger is moving structured data into a tool that expects tables. Spreadsheets, BI dashboards, and many database import wizards read CSV happily but choke on raw JSON. A typical input looks like:

`` [{"name":"Ada","age":36},{"name":"Linus","age":54}] ``

That becomes a header row of name,age followed by two data rows. The structural gap matters: JSON can hold a record inside a record, while CSV has no native notion of depth. That single difference drives most of the decisions a converter has to make. If you also want to read the JSON more comfortably first, the JSON Formatter helps before you convert.

How the Converter Builds Your CSV

The converter parses your JSON, then scans every object to build a complete set of column headers. Because records are not guaranteed to share the same keys, it collects the union of all keys so no field is silently dropped. Each object is then written as a row, with empty cells where a key is missing.

Nested objects are flattened using dot notation. A field like address containing { "city": "Oslo" } becomes a column named address.city. Arrays inside a value are serialized so the row stays a single line. Values that contain commas, quotes, or line breaks are wrapped in double quotes, and embedded quotes are doubled, following the standard CSV escaping rules.

For example:

name address.city tags
Ada Oslo a;b

The goal is a file that opens cleanly in Excel, Google Sheets, or a database import step without manual cleanup. Going the other direction later is just as easy with the CSV to JSON Converter.

Handling Nested Data and Special Characters

Real JSON is rarely flat, so the edge cases deserve attention. Deeply nested objects keep expanding their dot-notation path, so user.profile.contact.email is a valid single column. This keeps every value addressable without losing where it came from.

Arrays are trickier because a cell holds one value. The converter serializes array contents into the cell so the row count stays stable and each record maps to exactly one line. If your arrays are long or themselves contain objects, expect those cells to carry compact serialized text rather than separate columns.

Special characters are handled by quoting. Any value with a comma, a double quote, or a newline gets wrapped in quotes, and inner quotes are escaped by doubling them. Unicode passes through untouched. The result stays valid even for messy input like:

`` {"note":"Say \"hi\", then leave"} ``

Which becomes the safely quoted cell "Say ""hi"", then leave". The same logic protects fields that hold embedded newlines, so a multiline note stays inside one cell instead of spilling into extra rows.

Where This Conversion Earns Its Keep

The most common use is exporting API data into a spreadsheet. Many APIs return JSON arrays, and stakeholders who live in Excel or Google Sheets need that data as rows and columns. A quick conversion hands them something they can filter, pivot, and chart immediately.

Reporting is a close second. Analytics events, audit logs, and inventory snapshots often arrive as JSON, and a CSV version slots straight into reporting tools and database COPY or import commands. Data migration between systems also leans on CSV as a neutral interchange format that almost everything can read.

There is a human angle too. Non-technical teammates rarely want to read raw JSON, and a table is far more approachable. Converting first lets you share results without explaining brackets and braces, so a colleague can open the file and start filtering immediately. When the data also needs a different structure entirely, the JSON to XML Converter covers the XML route for systems that expect markup instead of rows, while spreadsheets remain the easiest destination for most everyday reporting.

Limits and Whether the Conversion Is Lossless

JSON to CSV is not perfectly lossless, and knowing why prevents surprises. CSV has no type system, so a number, a boolean, and the strings that look like them become indistinguishable text once written. The value false and the word "false" land in the same cell with no marker to tell them apart.

Structure is the other casualty. Nesting is flattened into dot-notation columns, and arrays are serialized into cells, so the original tree shape is not directly recoverable. Round-tripping back to JSON usually rebuilds a flat object rather than the exact nested original.

For tabular, mostly flat data such as records, rows, and reports, the conversion is faithful and practical. For deeply structured documents you may prefer to keep JSON or convert to a format that preserves hierarchy. If you only need cleaner JSON rather than a different format, run it through the JSON Formatter first to spot issues before exporting.

The ones we answer the most.

How do I convert JSON to CSV?

Paste a JSON array of objects into the input, and the converter reads the keys to build column headers and turns each object into a row. You then copy or download the CSV and open it in Excel, Google Sheets, or your database import tool. The input should be an array of objects rather than a single object for the cleanest table.

What are the key differences between JSON and CSV?

JSON is hierarchical and typed, so it can nest objects and keep numbers, booleans, and null distinct. CSV is a flat grid of text with one header row and one line per record, and it has no concept of depth or data types. Converting trades JSON's structure and typing for CSV's simplicity and broad tool support.

What happens to nested objects and arrays?

Nested objects are flattened using dot notation, so a field like user.address.city becomes its own column. Arrays inside a value are serialized into a single cell so each record still maps to one row. This keeps the table stable, though very deep or array-heavy data produces denser cells.

How are commas, quotes, and line breaks handled?

Any value containing a comma, double quote, or line break is wrapped in double quotes, and embedded quotes are escaped by doubling them. This follows standard CSV rules so the file opens correctly in spreadsheets without splitting cells in the wrong places. Unicode characters pass through unchanged.

Is the conversion lossless?

Not entirely. CSV has no type system, so numbers and booleans become plain text, and nesting is flattened into columns rather than preserved as a tree. For flat, tabular data the result is faithful, but deeply structured JSON cannot be rebuilt exactly from the CSV alone.

Can I convert the CSV back into JSON later?

Yes, you can reverse the process with the CSV to JSON Converter. Keep in mind that flattened columns rebuild a flat object rather than the original nested shape, so round-tripping is structurally approximate even when every value survives.