Documents

Convert JSON to CSV

Turns an array of objects into CSV text, quoting only where needed. The columns are every key found in any object, in order of first appearance; a value an object does not have stays empty. Up to 100,000 rows and 1,000 columns. If the data contains text you do not control (form answers, emails, web pages), set escape_formulas to true: text starting with = + - @ would otherwise be read as a formula when the CSV is opened in Excel or Google Sheets.

Costs 1 credit per call.

post/json-to-csv

Request

  • Base URL: https://api.cofferdock.com
  • URL: https://api.cofferdock.com/json-to-csv
  • Auth: API key in header x-api-key

Request body

dataobject[] required

The rows to convert: a non-empty array of objects (up to 100000), e.g. [{"name":"Ana","age":30}]. The columns are every key found in any object (up to 1000), in order of first appearance; a value an object does not have stays empty.

headerboolean

true (default) = write the column names as the first line; false = data rows only.

delimiterstring

Field separator, exactly one character: "," (default), ";", "|" or a tab. Any other value is ignored and "," is used.

escape_formulasboolean

true = protect against spreadsheet formula injection: every text value (and every column name) that starts with =, +, -, @, a tab or a carriage return gets a single quote added in front, so "=1+1" is written as "'=1+1" and Excel or Google Sheets read it as plain text instead of running it as a formula. JSON numbers (-5 without quotes), booleans, null, objects and lists are never changed. false = write the text exactly as received. Use true whenever the data includes text you do not control (form answers, emails, web pages). Only the start of each text is protected: a text with a separator and "=" in the middle can still be split into a new cell by a program whose list separator differs from the delimiter, so choose the delimiter the reader expects or use json_to_excel.

output'json' | 'csv'

How to return the CSV: "json" (default: the CSV text in a "csv" field of the JSON response) or "csv" (the CSV itself as the response body, text/csv).

Response

Result.

successboolean
csvstring

Changes

No recorded changes to this operation across all 1 revision of this API.