CSV to JSON / JSON to CSV
Free CSV to JSON and JSON to CSV converter. Paste tabular data, choose direction, and copy the result — handles quoted fields, headers, and escaping.
Quick answer
CSV is a flat, row-based text format with one record per line and fields separated by commas (or another delimiter). JSON is a hierarchical key-value format. The converter handles both directions, with optional first-row-as-headers and quote-escaping for fields containing commas or newlines.
CSV ↔ JSON Converter
How it works
CSV→JSON treats the first row as headers and converts each subsequent row into an object keyed by those headers. JSON→CSV walks an array of objects, builds a header row from the union of all keys, and writes one row per object. Handles quoted fields and escaped commas.
When to use it
Importing spreadsheet exports into a JS app, converting an API response to a spreadsheet, prepping data for a data-loading script, or converting between formats during ad-hoc data work.
Common mistakes
Inconsistent header names between rows in JSON-to-CSV (some objects missing keys others have) — the tool fills missing fields with empty strings. Also: CSV files with commas inside quoted fields — the parser handles standard CSV quoting but not all dialects.
How the converter works
CSV-to-JSON: parse each line as comma-separated fields, treating quoted fields as single values (so 'New York, NY' inside quotes is one field, not two). The first row's values become object keys; each subsequent row becomes an object with those keys. JSON-to-CSV: take an array of objects, use the first object's keys as the header row, then write each object as a comma-separated row. Fields containing commas, quotes, or newlines get wrapped in quotes; embedded quotes are escaped by doubling them.
When to use it
Importing spreadsheet data into a JSON-based API or config file. Exporting JSON API responses into a format Excel can open. Cleaning up data between systems with different format requirements. Quick inspection of CSV data when you want the structure visible. Bulk-uploading CSV records that need to be sent as JSON to an endpoint.
Common mistakes
- Forgetting that CSV has multiple dialects. Some use semicolons (common in Europe), some use tabs (TSV). The converter defaults to comma — change the delimiter setting if your input uses something else.
- Not quoting fields with embedded commas. A field like 'Smith, John' (last, first) needs to be wrapped in quotes in CSV. The converter does this automatically on JSON-to-CSV; on CSV-to-JSON it relies on you having quoted these correctly upstream.
- Assuming all JSON arrays are flat tables. Nested JSON (objects inside objects) doesn't have a clean CSV representation. The converter flattens one level by default; deeper nesting needs custom handling.
Frequently asked questions
How do I convert CSV to JSON?
Paste your CSV into the input area. The first row is treated as headers (toggleable). Each subsequent row becomes an object with those header keys. The output is a JSON array ready to copy.
Does the converter handle commas inside fields?
Yes — fields wrapped in double quotes are treated as single values, even if they contain commas or newlines. Embedded quotes are escaped by doubling (a literal quote inside a quoted field is written as "").
Why is my CSV not parsing correctly?
Most common causes: (1) the delimiter isn't a comma — try semicolon or tab if you're in a European or tab-separated context, (2) fields with embedded commas aren't properly quoted, or (3) line endings are mixed (CRLF vs. LF). Open in a plain text editor to inspect.