🧩

JSON to CSV

Convert a JSON array of objects into CSV text.

POST 1 credit /v1/convert/json-to-csv
curl -X POST "https://convert.toolkitapi.io/v1/convert/json-to-csv" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"data": [{"name":"Alice","age":30},{"name":"Bob","age":25}], "include_header": true}'
import httpx

resp = httpx.post(
    "https://convert.toolkitapi.io/v1/convert/json-to-csv",
    json={"data": [{"name":"Alice","age":30},{"name":"Bob","age":25}], "include_header": true},
)
print(resp.json())
const resp = await fetch("https://convert.toolkitapi.io/v1/convert/json-to-csv", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"data": [{"name":"Alice","age":30},{"name":"Bob","age":25}], "include_header": true}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response 200 OK
{
  "csv": "name,age\nAlice,30\nBob,25\n",
  "rows": 2,
  "columns": 2
}

Description

Convert a JSON array of objects into CSV text.

How to Use

1

1. POST a JSON array of flat objects in `data`.

2

2. Optionally set `delimiter` and `include_header`.

3

3. Read the `csv` string from the response.

About This Tool

Converts a JSON array of objects into a CSV string. Object keys become column headers (the union across all objects), preserving insertion order. Nested objects are flattened with dot-notation keys.

Why Use This Tool

Frequently Asked Questions

What if objects have different keys?
The union of all keys becomes the column set; missing values are empty cells.
Are nested objects flattened?
Yes — using dot-notation keys (e.g. `address.city`). Arrays are JSON-stringified into cells.
Can I use a custom delimiter?
Yes — pass `delimiter` (e.g. `;` or `\t`).

Start using JSON to CSV now

Get your free API key and make your first request in under a minute.