JSON to CSV API

Convert a JSON array of objects or arrays into CSV with a header row and a custom delimiter, returned as JSON or as a downloadable text/csv file.

POSThttps://apibox.io.vn/v1/json-to-csv

Send a JSON array in json, either as a value or as a JSON string (a raw text/plain body also works). Each object becomes a row and its keys become the header; arrays of arrays are written as plain rows. Nested objects and arrays are serialized as JSON text inside the cell, and values with commas, quotes or line breaks are quoted correctly.

Columns are the union of the keys of all objects, in the order they first appear; missing values become empty cells. Use delimiter for a separator other than a comma (for example ; for European Excel) and header=false to omit the header row.

By default the response is JSON with csv and row_count; with format=csv the API answers with the raw CSV as text/csv, ready to save as a file. The request body is limited to 5 MB.

Parameters

NameInTypeRequiredDefault
jsonbodyarrayyesArray of objects or arrays, as a JSON value or JSON string. A raw text/plain body is also accepted.
delimiterbody|querystringno,Field delimiter, e.g. ; or a tab.
headerbody|querybooleannotrueWrite the header row with column names.
formatbody|querystringnojsonSet to csv to receive the raw CSV (text/csv) instead of JSON.

Example

curl -X POST "https://apibox.io.vn/v1/json-to-csv" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"json":[{"name":"Alice","age":30,"tags":["admin","dev"]},{"name":"Bob","age":25,"tags":[]}]}'

Response

{
  "csv": "name,age,tags\nAlice,30,\"[\"\"admin\"\",\"\"dev\"\"]\"\nBob,25,[]",
  "row_count": 2
}

Use cases

  • Export API data or database query results to Excel or Google Sheets
  • Generate downloadable CSV reports in a web app
  • Convert JSON logs or analytics events into spreadsheets
  • Prepare data for import tools that only accept CSV

FAQ

How are nested objects handled?

Nested objects and arrays are written as JSON text in the cell, for example ["admin","dev"].

Can I download the CSV file directly?

Yes. Add format=csv and the response body is the CSV itself with Content-Type: text/csv.

Which columns are included?

Every key found in any object of the array, in the order it first appears. Objects that lack a key get an empty cell.

Related APIs

Start with 1,000 free requests every month. Get free API key →