DevBolt
Processed in your browser. Your data never leaves your device.

How do I convert CSV to JSON or JSON to CSV online?

Paste CSV data to convert it to a JSON array of objects (using the first row as keys), or paste a JSON array to convert it to CSV format. The tool handles quoted fields, commas in values, and various delimiters. Everything runs client-side.

CSV to JSON
Input
name,age,city
Alice,28,NYC
Bob,35,London
Output
[
  { "name": "Alice", "age": "28", "city": "NYC" },
  { "name": "Bob", "age": "35", "city": "London" }
]
← Back to tools

CSV ↔ JSON Converter

Convert between CSV and JSON formats. Handles quoted fields, custom delimiters, and nested commas.

About CSV ↔ JSON Conversion

  • Handles quoted fields with commas, newlines, and escaped quotes ("").
  • Supports custom delimiters: comma, tab, semicolon, and pipe.
  • CSV → JSON uses the first row as object keys (headers).
  • JSON → CSV flattens objects into columns — nested objects are stringified.
  • Everything runs in your browser — no data is sent over the network.

Tips & Best Practices

Common Pitfall

Commas inside fields require quoting

The CSV value "San Francisco, CA" must be wrapped in double quotes: "San Francisco, CA". If the value itself contains a double quote, escape it by doubling: "She said ""hello""". Many hand-edited CSV files break on this rule, causing columns to shift right and corrupt the entire row.

Pro Tip

CSV has no standard — TSV is often safer

Despite RFC 4180, CSV implementations differ on quoting, escaping, encoding, and line endings. Tab-Separated Values (TSV) avoids most issues because tabs rarely appear in data. Excel, Google Sheets, and most databases support TSV import. Use .tsv extension for clarity.

Real-World Example

Flatten nested JSON before converting to CSV

CSV is inherently flat (rows and columns). Nested JSON like {address: {city: "NYC"}} must be flattened to address.city or address_city. Arrays pose a harder problem — you'll need to either join values ("a,b,c") or create one row per array element. Decide your strategy before converting.

Security Note

CSV injection is a real attack vector

A CSV field starting with =, +, -, or @ is interpreted as a formula in Excel and Google Sheets. An attacker could inject =CMD("calc") into user-generated data. When exporting user input to CSV, prefix these characters with a single quote (') or tab character to prevent formula execution.

Frequently Asked Questions

How do I convert CSV to JSON?
Paste your CSV data with headers in the first row. DevBolt's converter automatically parses the CSV using the detected delimiter (comma, tab, semicolon, or pipe) and converts each row into a JSON object where keys are the column headers and values are the cell contents. The output is a JSON array of objects. The tool handles quoted fields, escaped characters, empty values, and multiline fields correctly. You can download the result as a .json file. This is useful for importing spreadsheet data into APIs, databases, and JavaScript applications.
How do I convert JSON to CSV?
Paste a JSON array of objects and the converter extracts all unique keys as CSV column headers, then maps each object's values to the corresponding columns. Nested objects are flattened using dot notation (e.g., address.city becomes a column). Missing values become empty cells. The output can be downloaded as a .csv file that opens directly in Excel, Google Sheets, or Numbers. This is ideal for exporting API data to spreadsheets, generating reports, and importing data into tools that only accept CSV format.
What delimiter should I use for CSV files?
Comma (,) is the standard and most widely supported delimiter. Use tab-separated values (TSV) when your data contains many commas (like addresses or descriptions). Semicolons are common in European locales where commas are used as decimal separators. Pipe (|) is used in some legacy systems and data warehouses. When choosing a delimiter, pick a character that does not appear in your data, or ensure values containing the delimiter are properly quoted. Most modern CSV parsers handle quoted fields correctly regardless of delimiter choice.

Related Convert Tools