PublicSoftTools

JSON to CSV Converter

Convert JSON data into CSV format quickly using this simple, browser-based converter. Ideal for developers, analysts, and spreadsheet tasks that require structured tabular data.

⏱ 7 min read · Complete guide below

JSON to CSV Converter

How to Convert JSON to CSV

  1. 1Paste your JSON into the input box. The input must be an array of objects — each object becomes a CSV row and its keys become column headers.
  2. 2Click Convert to CSV. The CSV output appears below. If there is a syntax error in your JSON, a descriptive error message is shown instead.
  3. 3Click Copy to copy the CSV to your clipboard, then paste into Excel, Google Sheets, or your database import tool.
  4. 4Values containing commas, quotes, or newlines are automatically escaped per RFC 4180, so the output is always valid CSV.

When to Use Each Format

JSON, CSV, and XML each have strengths. Choosing the right format for the task avoids unnecessary conversion and keeps data integrity intact.

Format Comparison & Use Cases

JSON for APIs

JSON is the default format for REST and GraphQL APIs. Use it for data that has nested structures — user objects with address sub-objects, product lists with variants. Convert to CSV only when you need to open data in a spreadsheet.

CSV for Spreadsheets

CSV is the universal import/export format for Excel, Google Sheets, and database import tools. Convert API JSON responses to CSV when you need to share data with non-technical stakeholders or bulk-import into a database.

XML for Legacy Systems

Many enterprise systems (SOAP APIs, EDI, older CMS platforms) still use XML. Convert JSON to XML when integrating with these systems, or XML to JSON when you want to process the data in modern JavaScript/Python code.

Config File Migration

Some tools store configuration in XML (Maven pom.xml, Spring, Android resources) while others use JSON (package.json, tsconfig). Use the converter when migrating settings between tools or generating config from a structured data source.

Data Pipeline Debugging

Paste the raw output of an API response or database export to quickly see it in a more readable format. JSON-to-CSV is especially useful for visualising flat API responses in a tabular view before loading into a database.

Importing into Databases

Most databases accept CSV imports natively. Convert your JSON API data to CSV, then import directly into PostgreSQL (COPY command), MySQL (LOAD DATA), or MongoDB (mongoimport with --type csv).

The Complete Guide to JSON-to-CSV Conversion

Converting JSON to CSV is one of the most common bridging tasks in data work: an API or application hands you data as JSON, but a colleague, a spreadsheet, or a database wants it as CSV. The conversion is straightforward for well-shaped data but full of subtle traps for anything more complex. This guide covers the one rule that makes conversion possible, how to handle nested data, and the import gotchas — especially in Excel — that quietly corrupt data if you are not watching for them.

Why It Must Be an Array of Objects

The fundamental requirement for clean JSON-to-CSV conversion is that your JSON be an array of objects, where each object shares the same set of keys. The reason is structural: CSV is a grid, so it needs a consistent set of columns (the keys) and a series of rows (the objects). Each object becomes one row, and its keys become the column headers. A JSON array like a list of users, orders, or products — each with the same fields — maps onto that grid perfectly.

Problems arise when the data does not fit this shape: a single object rather than an array, objects with different keys from one another, or values that are themselves objects or arrays. Where objects have inconsistent keys, a good converter takes the union of all keys as the header and leaves cells blank where a given object lacks a field. But genuine nesting — structure inside a value — has no natural home in a flat grid, which is the central challenge.

Handling Nested JSON

Because CSV cannot represent hierarchy, nested JSON must be flattened before or during conversion, and there are a few standard strategies. The most common is dot-notation flattening: a nested field like address: { city: "Paris" }becomes a column named address.city. This preserves all the data in a readable way and is the approach most robust converters use for nested objects. It keeps the CSV flat while still capturing the full structure in the column names.

Arrays inside a record are trickier, since a single cell cannot naturally hold a list. The pragmatic options are to serialise the array into one cell as a JSON string or a delimited list (simple, but you lose easy per-value access), or to “explode” the array into multiple rows (one row per array element, repeating the parent fields), which suits some analytical workflows. There is no perfect answer — each is a compromise — which is exactly why deeply nested data is often better kept as JSON. If your data is genuinely hierarchical and you do not truly need a spreadsheet, converting to CSV may lose more than it gains.

Import Gotchas: When Excel Fights You

Producing valid CSV is only half the battle; getting it into a spreadsheet or database intact is the other, and Excel in particular is notorious for silently mangling data. The most infamous problem is leading zeros: a ZIP code or product code like 01234 is interpreted as the number 1234, dropping the zero. Excel also loves to auto-convert anything that looks like a date — a gene name or a version string like 1-2 can become “2-Jan” — and can turn long numeric IDs into scientific notation. These conversions happen on import, not in your CSV, so the file is correct but the spreadsheet corrupts it.

The defences are worth knowing. Rather than double-clicking a CSV, use Excel's “Import Data” or Power Query flow, which lets you set each column's type to “Text” and preserve the raw values. Also mind character encoding: CSV should be saved as UTF-8 so that accented and non-Latin characters survive, and adding a byte-order mark sometimes helps Excel detect it. For database imports, most systems ingest CSV natively — PostgreSQL's COPY, MySQL's LOAD DATA, or mongoimport — but they expect the header row and consistent columns that a clean conversion provides. Because this converter follows the RFC 4180 quoting rules, wrapping any value containing a comma, quote, or newline in quotes, its output imports reliably into these tools — the remaining care is on the spreadsheet side, where knowing Excel's habits saves you from silent data loss.

Frequently Asked Questions

Why does JSON to CSV require an array of objects?

CSV is a flat, tabular format — rows and columns. A JSON array of objects maps naturally to this structure: each object is a row, and the object keys become column headers. Deeply nested JSON (objects within objects, or mixed arrays) cannot be flattened into a CSV without ambiguity. If your JSON is nested, flatten it first before converting.

How are commas and quotes in CSV values handled?

The converter follows RFC 4180 CSV conventions. If a value contains a comma, double quote, or newline, the entire value is wrapped in double quotes. Any double quotes inside the value are escaped by doubling them (""). For example, the value She said "hello" becomes "She said ""hello""" in the CSV output.

Can I convert CSV files with special characters or international text?

Yes. The converter processes text as JavaScript strings (UTF-16 internally), which supports all Unicode characters. Accented characters, CJK characters, Arabic, and emoji are all handled correctly. The output is also Unicode text that you can save as a UTF-8 encoded file.

Is there a size limit for the data I can convert?

There is no enforced limit — conversion runs in your browser using JavaScript. Practical limits depend on your browser and device memory. Files up to a few megabytes convert quickly; very large datasets (tens of thousands of rows) may take a second or two. For files larger than ~10 MB, a command-line tool like jq (for JSON) or csvkit will be faster.

Is my data sent to a server?

No. All conversion logic runs entirely in your browser. Your data is never uploaded to any server, never logged, and never stored. This makes the tool safe for sensitive business data, internal APIs, and personal datasets.