CSV to JSON - API - scripts
Convert CSV to clean JSON
Updated: May 2026
CSV is convenient for spreadsheets, but APIs, scripts and automations often expect JSON. This page covers CSV to JSON conversion: headers, data types, delimiters, empty lines and a clean output that can be used in technical workflows.
Free - No upload - Browser-based conversion
When to convert CSV to JSON
The most common scenarios: feeding a REST API with a product list exported from a spreadsheet, importing data into a NoSQL database like MongoDB or Firestore, generating test fixtures for a Node.js or Python script, or connecting a Google Sheets export to a Make or Zapier automation that expects JSON.
CSV to JSON also helps when you need to inspect data structure before piping it into a tool — JSON is easier to validate and debug than a flat file.
The first row is crucial
The header row becomes the property names of every JSON object. Column names should be concise and free of special characters. Spaces are preserved but may cause problems in some APIs — consider using camelCase or underscores.
name,age,active
Alice,30,true
Bob,25,false
Produces:
[
{"name":"Alice","age":30,"active":true},
{"name":"Bob","age":25,"active":false}
]
Type inference
When type inference is enabled, the converter automatically converts compatible values to their native JSON type instead of leaving everything as strings.
- "42" becomes the number 42.
- "3.14" becomes the number 3.14.
- "true" and "false" become booleans.
- An empty cell becomes null.
This matters when consuming the JSON in a typed context — a REST API or a database schema that validates types will reject "42" as a number.
Nested objects from dot-notation columns
If your CSV headers use dot notation (user.email, address.city), the tool can reconstruct nested JSON objects. A column named user.email becomes {"user":{"email":"..."}} instead of a flat key.
CSV pitfalls to watch for
- BOM encoding — Excel sometimes adds a hidden byte-order mark at the start of the file that corrupts the first column header.
- Variable separators — a file may mix commas and semicolons across rows if it comes from multiple sources.
- Fields with line breaks — a multi-line address inside a quoted field breaks naïve CSV parsers that split on newlines.
How to do it with Flowfiles
- Open the JSON CSV converter.
- Switch to CSV to JSON mode.
- Paste the CSV content.
- Select the correct delimiter (comma, semicolon, or tab).
- Enable type inference if needed.
- Convert, then copy or download the JSON.
Frequently asked questions
Can I convert a CSV exported from Excel?
Yes. Excel CSVs work well. If the file uses semicolons instead of commas (common in European locales), select the semicolon delimiter before converting. If your headers look garbled, the file likely has a BOM — paste the content manually to remove it.
How do I handle a CSV without a header row?
The tool uses the first row as headers. If your file has no headers, add a row of column names at the top before pasting — otherwise the first data row becomes the JSON keys.
Should I remove the BOM before pasting?
If you paste directly from a text editor the BOM usually disappears. If the first key in your JSON looks like "name" instead of "name", the BOM is present — delete the invisible character at the very start of the input.
Are dates converted?
Dates are kept as strings. The tool does not convert "2026-05-20" to a Date object because JSON has no native date type. Parse the string in your application code after conversion.
Is the JSON output always valid?
Yes, the tool only produces output when the input parses correctly. If the CSV is malformed (unbalanced quotes, mismatched column count), the converter reports an error rather than generating broken JSON.
Can I get an indexed object instead of an array?
The default output is an array of objects. If you need a keyed object ({"1":{...},"2":{...}}), you can post-process the JSON array in your code using a reduce or Object.fromEntries in JavaScript.