Skip to content
UniKit

JSON to CSV

Convert an array of JSON objects to CSV / TSV with union headers, flattened nested keys, custom delimiters, quote escaping, BOM and a preview table.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

JSON array
CSV output
Rows: 0Columns: 0Bytes: 0

What this tool does

  • Export an API response array to CSV and open it in Excel or Google Sheets for non-technical colleagues or further filtering.
  • Tidy up analytics or export data: headers are the union of every object’s keys, so objects with missing fields never shift the columns.
  • Deal with nesting: by default meta.city is flattened into a.b notation, or you can switch to serializing the whole nested value as a JSON string to keep the structure intact.
  • Make Chinese text readable in Excel: enabling the UTF-8 BOM prevents mojibake, and you can switch the delimiter to tab or semicolon at the same time.

Example

Input

[{"name":"Alice","age":30,"tags":["admin","beta"]},{"name":"Bob","age":25,"meta":{"city":"Shanghai"}}]

Output

name,age,tags,meta.city
Alice,30,"[""admin"",""beta""]",
Bob,25,,Shanghai

Headers are the union of the keys from both objects, which is why the first row has meta.city and the second does not. Arrays are serialized as JSON strings and their inner double quotes are doubled per CSV rules.

Frequently asked questions

Why is the header order different from what I wrote?

By default columns follow first-seen key order, gathered as a union across all objects. If you want a stable, predictable layout, enable "sort headers alphabetically" so every export uses the same column order and version comparison stays easy.

How are nested objects and arrays handled?

The default "flatten to a.b" expands nested objects into dotted paths such as meta.city, while arrays are serialized into a JSON string inside the cell. Switch to "serialize as JSON strings" and nested objects are serialized whole too, which suits data whose shape varies too much to split into columns.

Chinese characters look garbled in Excel — what now?

Enable the UTF-8 BOM. Without it, Excel on Windows guesses the local codepage (GBK) and mangles Chinese; with the BOM it detects UTF-8 correctly. Numbers and LibreOffice usually cope either way.

What if the top level is not an array?

You get "the top level must be a JSON array". This tool only handles arrays, so wrap a single object as [ {…} ] yourself. JSON syntax errors are reported with the reason and position — an unexpected end from an unclosed bracket or quote, a missing colon after a key, and so on.

Is the data uploaded?

No. Parsing, flattening and escaping all run in your browser, no network request is made and it works offline. API payloads and user data are never uploaded or logged.

Keywords:jsoncsvtsvjson 转 csvexcel转换flatten嵌套对象bom

Related tools