Skip to content
API REFERENCEv2

JSON to CSV API

Convert a JSON array into CSV with one REST API request.

REST APIv2 · Direct CSV outputJSON in. CSV out.1 credit per successful conversion

Try JSON to CSV

Sample preview
POSThttps://api.tableconvert.com/v2/convert/json-to-csv

CSV response

"name","email","active"
"Alice","alice@example.com","true"
"Bob","bob@example.com","false"

Sample previews run in your browser and use no credits.

CSV options
Sending a successful live request uses 1 credit.

Your key is sent only to the API and is never saved by this page.

JSON to CSV API examples

Choose a language, set TABLECONVERT_API_KEY in your environment, and run the request. Each example saves the CSV response to output.csv.

cURL quickstart

curl --fail-with-body --max-time 40 \
  'https://api.tableconvert.com/v2/convert/json-to-csv' \
  --header "Authorization: Bearer $TABLECONVERT_API_KEY" \
  --form-string 'data=[{"name":"Alice","email":"alice@example.com","active":true},{"name":"Bob","email":"bob@example.com","active":false}]' \
  --output output.csv

Requires cURL. Use --form-string to send JSON as text; cURL sets the multipart boundary for you.

Authentication and response

Send your API key in the Authorization: Bearer header. For a successful v2 request, the response body is CSV text, not a JSON envelope or a download URL.

Keep API keys in server-side environment variables in production. Never put a key in a public repository or a URL.

Request parameters

Send multipart/form-data. Choose one input source: data, file or url. Do not manually set the Content-Type header; your HTTP client adds the multipart boundary.

ParameterTypeDescription
datastringJSON text. A nonempty array of flat objects is the clearest way to send records.
filebinaryA .json file upload. Use file=@records.json with cURL.
urlstringA public HTTP or HTTPS URL to a JSON file.

One input required

CSV output options

Add these optional form fields to control the CSV output. The defaults below match this page’s sample.

ParameterDefaultDescription
output[doubleQuote]booleantrueWrap every field in double quotes. Embedded quotes are not doubled automatically; normalize those values before conversion.
output[bom]booleanfalsePrefix the output with a UTF-8 byte order mark, useful for some Excel import workflows.
output[valueDelimiter]string,Separate columns with a comma, semicolon or TAB.
output[rowDelimiter]stringNEWLINESeparate rows. NEWLINE produces CRLF line endings.
output[prefix]stringEmpty stringText prepended to each row.
output[suffix]stringEmpty stringText appended to each row.

Nested JSON and field mapping

This endpoint converts tabular records. Check these mapping rules before exporting data from an API, database or application.

InputCSV behavior
Different object keysColumns use the union of all keys, in the order each key first appears.
Missing fieldAn empty CSV cell.
nullThe text null; it is not an empty cell.
Numbers and booleansConverted to text, for example 42, true and false.
Nested objectNot flattened. The cell becomes [object Object]. Prepare flat records before sending.
Array inside a fieldNot expanded into rows. Its values become a comma-separated string.
Double quotes inside a valueInternal quotes are not escaped automatically. Normalize or remove them before exporting.

Need columns from nested JSON?

Prepare the fields you want before making the request. This example turns profile.city into a city column; it does not require a flatten API parameter.

const records = [
  { name: "Alice", profile: { city: "London" } },
];

const rows = records.map(({ name, profile }) => ({
  name,
  city: profile.city,
}));
// Send JSON.stringify(rows) in the data form field.

Responses and errors

Check the HTTP status before saving the response. Successful v2 responses use text/plain; error bodies contain a plain-text message.

StatusMeaningWhat to check
200text/plain; charset=utf-8CSV response
400Missing API key or unsupported requestAdd the Bearer header and check your input fields.
403Invalid API keyCheck the key in your account.
402Insufficient creditsReview your balance or plan before retrying.
413Input too largeCheck the upload and text-field limits below.
415Unsupported request encodingSend the documented multipart/form-data request.
429Too many requestsWait before retrying; avoid immediate retry loops.
500JSON parsing or conversion failedValidate the JSON and send a nonempty array of records.
503Conversion timed out or service unavailableTry a smaller input or retry later.

Limits and usage

File uploads support up to 50 MiB (52,428,800 bytes). An individual multipart text field is limited to 1 MiB; use file upload for larger JSON. The v2 processing deadline is 30 seconds.

A successful standard JSON to CSV conversion uses 1 credit. Failed or timed-out conversions release the reserved credit. Legacy account terms may differ; check your account and current pricing.

View API pricing

Using the original API?

This page documents v2, which returns CSV directly. The original /convert/json-to-csv endpoint returns a JSON envelope. Keep the response handling that matches your API version.

API overview

Questions before you integrate

Does this API automatically flatten nested JSON?

No. Flatten nested objects into the columns you need before sending records. The mapping table and preparation example above describe the current behavior.

How do I upload a JSON file instead of pasting data?

Use the file form field and omit data. With cURL, replace --form-string 'data=…' with --form 'file=@records.json;type=application/json'.

How do I create a semicolon-delimited CSV for Excel?

Add output[valueDelimiter]=; to the multipart form. If your Excel import workflow needs a UTF-8 BOM, also set output[bom]=true.

Can I try the example without an API key?

Yes. Preview sample runs the flat-record example in your browser without an API call. Sending a live request requires your key and follows normal API billing.