ToolSec

JSON ↔ CSV Converter

Convert a JSON array of objects to CSV and back, with proper quoting and headers.

Updated: June 27, 2026

Move data between JSON and CSV

JSON is how APIs and applications exchange structured data; CSV is what spreadsheets, analysts and many data pipelines expect. This converter bridges the two: turn a JSON array of objects into a clean CSV with a header row, or parse a CSV back into JSON objects. It handles the fiddly parts — quoting values that contain commas, escaping quotes, and reconciling rows with different keys — so you don't have to. Conversion runs in your browser; nothing is uploaded.

How the conversion works

For JSON → CSV, the input should be an array of objects (a single object also works). The tool collects the union of all keys across every object to build the header row, so rows that are missing a field simply get an empty cell. Values containing a comma, quote or newline are wrapped in double quotes and any internal quotes are doubled, following the CSV convention in RFC 4180.

For CSV → JSON, the first row is treated as the header, and each subsequent row becomes an object keyed by those headers. The parser correctly handles quoted fields — including values that contain commas or span multiple lines inside quotes — which naive "split on comma" approaches get wrong.

Things to watch out for

  • Nested objects/arrays. CSV is flat. Nested JSON values are serialized as JSON text inside the cell, since there's no native CSV representation for them.
  • Types are lost going to CSV. Numbers and booleans become plain text; when converting CSV back to JSON, every value is a string unless you cast it afterward.
  • Inconsistent keys. That's fine here — the union-of-keys approach keeps every column and leaves gaps empty.

Common uses

  • Exporting an API response into a spreadsheet for a colleague.
  • Turning a CSV export into JSON to seed a database or fixture.
  • Quickly eyeballing tabular data that arrived as JSON, or vice versa.

Pair it with these

Tidy your JSON first with the JSON formatter, convert config between formats with the YAML ↔ JSON converter, or extract fields from messy text using the regex tester.

Frequently asked questions

What JSON shape does this expect?

An array of objects, like [{"a":1},{"a":2}]. A single object also works. The keys across all objects become the CSV columns, so rows can have different fields.

How are commas and quotes inside values handled?

Following RFC 4180, any value containing a comma, double quote or newline is wrapped in double quotes, and internal quotes are doubled. The CSV parser reverses this correctly when converting back to JSON.

What happens to nested objects or arrays?

CSV is flat, so nested values are serialized as JSON text within the cell. If you need a fully flattened structure, flatten the JSON before converting.

Why are my numbers strings after CSV → JSON?

CSV has no type information — every field is text. The converter keeps values as strings; cast them to numbers or booleans in your code if you need typed data.

Data tooling

For larger or recurring data jobs, consider:

  • ETL / data pipeline platform Automate format conversions and transformations between APIs, files and databases at scale.
  • Spreadsheet / BI tool Import the resulting CSV for analysis, pivot tables and shareable dashboards.

Learn more

Related tools