Skip to main content

csv-json

A CSV-to-JSON converter parses tabular comma-separated values into a JSON array of objects (one object per row, keyed by header), and the reverse operation flattens a JSON array back into a CSV file. The ZTools CSV ↔ JSON tool supports auto-detected delimiters (comma, semicolon, tab, pipe), quoted fields containing commas or newlines per RFC 4180, custom header rows, and configurable null-handling. Everything runs in your browser; even 100 MB CSV exports parse without uploading. The tool is bidirectional: paste either format, click the matching button, and get the other format with consistent escaping.

Use cases​

Importing spreadsheet data into a JavaScript application​

Export your Google Sheet or Excel file as CSV, paste it here, convert to JSON, and copy the result directly into a .json data file or an in-memory mock dataset. Saves the round trip through Papa Parse or csv-parser in your build pipeline for one-shot ingestion tasks.

Exporting API responses to spreadsheets​

Many APIs return JSON arrays of objects (users, orders, log entries). Paste the JSON, click "JSON β†’ CSV", and the tool produces a header row plus one data row per object β€” open directly in Excel, Google Sheets, or Numbers.

Cleaning a malformed CSV before importing into a database​

CSVs from legacy systems often have stray quotes, mixed delimiters, or missing trailing commas. Paste the CSV, convert to JSON to canonicalize, then convert JSON back to CSV. The round trip rewrites every field with consistent quoting and escaping.

Generating fixture data for unit tests​

Maintain test data as a CSV (easy to edit in any spreadsheet), then convert to JSON at test-bootstrap time so your test fixtures stay readable to non-developers (QA, product managers) but consumable by your test runner.

How it works​

  1. Paste your CSV or JSON into the input pane β€” The tool auto-detects the format based on the first non-whitespace character. Drag-drop a .csv or .json file works too.
  2. Choose the conversion direction β€” Click "CSV β†’ JSON" or "JSON β†’ CSV". The opposite-direction button is disabled when the input format does not match.
  3. Configure options if needed β€” Set the delimiter (auto, comma, semicolon, tab, pipe), specify whether the first row is a header, and choose null-value handling (empty string, JSON null, or omit).
  4. Review the output β€” Output appears in the right pane with syntax highlighting. CSV output uses RFC 4180 quoting; JSON output is pretty-printed for readability.
  5. Copy or download β€” One-click copy or download as .csv / .json. The original input remains untouched in the left pane for re-conversion with different settings.

Examples​

Input: name,age,city Ahsan,32,Lahore Fatima,28,Karachi

Output: [ { "name": "Ahsan", "age": "32", "city": "Lahore" }, { "name": "Fatima", "age": "28", "city": "Karachi" } ]


Input: [{"id":1,"label":"alpha,beta"},{"id":2,"label":"gamma"}]

Output: id,label 1,"alpha,beta" 2,gamma

Frequently asked questions​

Does the tool handle quoted fields with commas inside?

Yes. The parser is RFC 4180 compliant, so a field like "Smith, John" is treated as a single value containing a literal comma. Embedded quotes are escaped per spec (doubled "").

What if my CSV uses semicolons instead of commas?

Set the delimiter to semicolon, or leave it on auto-detect β€” the tool sniffs the first 1,000 characters to guess the delimiter. Tab-separated values (TSV) and pipe-delimited values are also supported.

Can the tool handle large files?

Yes β€” files up to ~100 MB parse comfortably on a modern desktop browser. The conversion happens off the main thread to keep the UI responsive.

How are nested JSON objects flattened to CSV?

Nested objects are flattened with dot-notation keys (e.g. address.city). Arrays inside JSON objects become JSON-stringified strings within the CSV cell. For complex nesting, prefer the JSON format.

Is type information preserved?

CSV is a string-only format, so number and boolean types are lost on JSON β†’ CSV. On the reverse path, you can opt in to type-coercion (numeric strings become numbers, "true"/"false" become booleans). Disabled by default to avoid silent data loss.

Is my data uploaded anywhere?

No. Conversion happens entirely in your browser. Disconnect from the internet after page load and the tool still works β€” proof that nothing is sent server-side.

Tips​

  • Always inspect the first 5 output rows to verify headers were detected correctly.
  • For files over 50 MB, increase your browser memory by closing other tabs before converting.
  • When round-tripping CSV β†’ JSON β†’ CSV, expect minor whitespace and quoting normalization β€” semantically identical, byte-different.
  • For production ETL pipelines, use Papa Parse (CSV) or fast-csv (Node) β€” this tool is for ad-hoc one-shot conversions.

Try it now​

The full csv-json runs in your browser at https://ztools.zaions.com/csv-json β€” no signup, no upload, no data leaves your device.

Open the tool β†—


Last updated: 2026-05-05 Β· Author: Ahsan Mahmood Β· Edit this page on GitHub