Tools API Blog
Sign in Create account

JSON to CSV

JSON to CSV is an API that converts an array of JSON objects into a CSV, with columns taken from every object's keys. It quotes only where needed (if a value contains a comma or a quote), not every field.

How it works

You send data (an array of objects) and get back the CSV text, ready to download or save. If some object has a field the others do not, that field becomes a column and stays empty where it is missing.

All you need

  • Your API key. Create it in your dashboard with "+ Create key".
  • In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream…).

How to use it in n8n

  • Method: POST · URL: https://api.cofferdock.com/json-to-csv
  • Send Headers: x-api-key = your key, Content-Type = application/json
  • Send Body (JSON): { "data": [{"name":"Ana","age":30},{"name":"Luis","age":25}] }

Options

OptionDefaultWhat it does
data-Required. Array of objects. The columns are every key found in any of them.
headertrueInclude the column-name row.
delimiter,A single character.
escape_formulasfalseSet it to true when the text in data comes from third parties (forms, emails, web pages). Text starting with =, +, - or @ is written with a single quote in front, so the spreadsheet reads it as text, not as a formula. Through MCP (AI assistants) it is true by default. Details below.

What you get back

csv, the ready-to-use text. With output=csv, the raw CSV as the response body (Content-Type: text/csv), no JSON wrapper.

If the data comes from third parties

If a text cell starts with =, +, - or @, Excel and Google Sheets can read it as a formula when the CSV is opened. Whoever controls that text (the person filling in a form, the sender of an email) could make someone else's spreadsheet send its data to a website. It is called formula injection.

With "escape_formulas": true, every text starting with one of those signs, a tab or a carriage return gets a single quote in front: =1+1 is written as '=1+1 and the spreadsheet treats it as text. Column names are covered too. Numbers are left alone: a -5 sent without quotes stays the number -5.

It is false by default, so the CSV comes out exactly as it always did. When the tool is used from an AI assistant through MCP, it is true by default (the assistant can turn it off by sending false). Turn it on as soon as you mix in text you do not control. The quote becomes part of the text and shows up in the spreadsheet: a phone number that arrives as the text +34 600 000 000 would come out as '+34 600 000 000. If a value must stay a number, send it as a number (no quotes).

Limit: only the start of each text is protected. If the program that opens the file uses a different list separator than the file (for example Excel set to Spanish, which expects ;, opening a comma-separated CSV), a text with ;= in the middle can be split into two cells, and the second one starts with =. Use the delimiter the reader expects, or produce an Excel file with JSON to Excel.