PDF & image

How to Convert CSV to JSON and Back

Parse quoted CSV, choose delimiters and headers, preserve important strings and reverse flat JSON to CSV with two worked examples and clear limits.

By the Criza Labs team · Updated · 5 min read

Key takeaways

  • Quoted fields can contain separators, escaped double quotes and newlines.
  • Leave typing off when exact textual representations must be retained.
  • Reverse mode accepts flat objects or arrays, without nested cell values.

The CSV to JSON converter turns delimited text into a JSON array in your browser. Paste input or choose a local UTF-8 file, then select how columns become JSON values. A reverse mode converts simple JSON rows back to CSV. Input and output remain on the device, and downloads use local browser files.

Start by deciding whether the first row contains names or data. That choice changes the output: a header row supplies object keys, while a headerless table works naturally as an array of arrays. Also decide whether values such as 0021, false or 2.50 must remain exact strings or should become typed JSON values.

CSV structure and delimiter choice

The parser follows the familiar quoting conventions documented in RFC 4180, checked 16 November 2026. Double-quoted fields can contain commas, line breaks and escaped quotes. An internal double quote is represented by two double quotes. This implementation also accepts semicolon, tab and pipe separators as explicit alternatives to commas.

Auto-detection examines up to twenty complete records and favours a separator giving consistent multi-column rows. Quoted newlines stay inside a record during detection. This remains a heuristic: short, irregular or single-column input can be ambiguous. Use the Delimiter selector to override an incorrect guess before trusting the output.

A closing quote must be followed by a separator, a record boundary or the end of input. Extra text after a closing quote is rejected rather than silently repaired. The parser accepts CRLF, LF and CR record endings and removes an initial UTF-8 byte order mark. A final record terminator does not add an extra empty record.

Step by step with CrizaTools

  1. Choose CSV to JSON under Conversion. Switching conversion modes clears the previous input so it is not interpreted as the other format accidentally.
  2. Paste into CSV input, or use Drop a CSV file or choose a file. The file area accepts UTF-8 text up to 1 MB.
  3. Leave Delimiter at Auto-detect or select Comma, Semicolon, Tab or Pipe. Check the detected separator in the status line.
  4. Enable Header row if the first record contains column names. Choose Array of objects or Array of arrays under JSON structure.
  5. Enable Convert numbers and booleans only if those values should become typed JSON. Keep Pretty JSON checked for readable indentation or uncheck it to minify.
  6. Review Converted output, then use Copy or Download .json. Use Clear when finished or before pasting a different dataset.
  7. For reverse conversion, choose JSON to CSV, paste a JSON array, choose an output delimiter and review Include header for objects before downloading .csv.

Objects require a header row, so choosing objects enables that option. Turning Header row off switches the structure to arrays. When a header is enabled, every data row must have the same field count as that header, including rows destined for array output.

Worked example: typed object records

Paste this CSV:

name,qty,paid
Tea,2,true

Leave Header row on, choose Array of objects and enable Convert numbers and booleans. The result contains one data row:

[
  { "name": "Tea", "qty": 2, "paid": true }
]

With typing disabled, qty becomes the string "2" and paid becomes the string "true". The row count remains one. Pretty JSON changes indentation only; minification does not change the values or structure. This example is verified by the parser tests.

Try a related row with id,n as headers and 001,9007199254740993 as values. Even with typing enabled, both values stay strings: the first has leading zeros, and the second exceeds the safe integer range used by the typing rule. Do not rely on this rule to preserve every decimal representation; leave typing off for exact text.

Worked example: quoting and reverse conversion

Switch to JSON to CSV and enter:

[{"name":"Tea","note":"a,b"}]

Use Comma and leave Include header for objects checked. The output is:

name,note
Tea,"a,b"

The comma inside the note is protected by quotes. Downloaded records use CRLF separators. Converting this output back with a header produces the same two string values. The reverse-formatting result is checked in Node, including its record separator and quotes.

For a note containing He said "yes", CSV doubles the inner quotes and surrounds the field with quotes. A newline inside a quoted field remains part of that single cell. Do not split such a file into physical lines before importing it, because a physical line need not represent a complete record.

Limits and preservation choices

Files are limited to 1 MB, and pasted input to 1,000,000 characters. Parsing supports up to 10,000 rows and 200 columns; the header counts toward the CSV parsing row cap. Object headers must be non-empty and unique, since duplicate keys would otherwise lose information. Choose arrays or edit the header when names repeat.

Typing recognizes lowercase true and false and numeric forms accepted by its rule. Blank values stay empty strings. Leading-zero representations remain strings, but decimal conversion can lose insignificant zeros or precision. A value such as 2.50 becomes a number rather than a record of how the original text was formatted.

Reverse mode accepts an array of flat objects or an array of arrays. It uses the union of object keys for columns; missing and null values become empty cells. Nested values and unsafe JSON numbers are rejected; quote large identifiers as strings. Empty strings, missing values and null cannot always be distinguished after a CSV round trip.

Common mistakes

Do not leave Header row enabled when the first row is real data: that row will be treated as names. Do not expect auto-detection to repair inconsistent quoting or uneven records. Check the chosen delimiter and the first few output objects before downloading a larger conversion.

Reverse conversion does not neutralize formula-like cell content. If opening CSV in a spreadsheet, inspect cells beginning with formula-like characters and apply your receiving application’s handling process. Quoting protects delimiters; it does not itself promise a particular spreadsheet interpretation. This is a text converter, without spreadsheet formulas, worksheets or formatting.

Questions and answers

Why are all my numbers quoted in JSON?

Typing is off by default. Enable Convert numbers and booleans if typed output is appropriate, or keep strings when preserving text matters.

Can I use semicolon-separated exports?

Yes. Auto-detection supports semicolon, and the selector offers an explicit Semicolon override alongside comma, tab and pipe.

Why are duplicate headers rejected?

Object keys must be unique to preserve every column. Rename the duplicate headers or choose Array of arrays.

Can reverse mode flatten nested objects?

No. Prepare flat rows first. Nested values inside cells are rejected with an error rather than converted into ambiguous text.

Does the converter upload chosen files?

No. The browser reads the selected file locally. The converter does not save a server copy or add its contents to the page address.

Use the CSV to JSON converter for tabular conversions and the JSON formatter to inspect a larger JSON structure separately.

Free tools for this

PDF & image

CSV to JSON Converter

Convert pasted CSV or a local file to JSON with delimiter detection, headers, optional typing and downloads.

PDF & image

JSON Formatter

Format, validate and minify JSON in your browser. Shows the line and column of any error, sorts keys and copies or downloads the result.

PDF & image

Text Difference Checker

Compare two texts by line or word, see added and removed counts, and switch between inline and side-by-side views.

More guides

Free desktop app from Criza Labs

Bill every day? Get CrizaVoise free

GST invoices, thermal receipts, stock and payments in one offline app for Windows, Linux and macOS. No subscription, no sign-up, no ads, and your data stays on your computer.

  • 58 mm and 80 mm thermal printing
  • UPI QR on every invoice, WhatsApp sharing
  • Open source (Apache 2.0), English, Hindi, Gujarati and more
The CrizaVoise dashboard with quick bill and new invoice buttons, stock alerts and sample figures