Skip to content
FormatKit

Free online CSV to JSON converter

CSV to JSON that keeps 007 a string

This CSV to JSON converter is free, needs no signup, and turns up to 5 MB of delimited text into an array of objects keyed by your header row. The delimiter is worked out from the file itself, quoted fields keep the commas and line breaks inside them, and type inference is deliberately conservative: 007 stays a string, a 16-digit order number stays a string, and only a value that matches the JSON number grammar exactly becomes a number. Rows that are the wrong width and headers that repeat are reported by line rather than quietly fixed.

  • 100% free
  • No signup
  • Up to 5 MB
  • Delimiter detected
  • Leading zeros kept
JSON

The JSON appears here as you type.

Paste CSV, open a file, or press Ctrl+V anywhere on this page.

Four cells that most converters get wrong

Every value in this file is ambiguous, and the wrong reading of any of them is silent data loss rather than an error.

Four rows of CSV

zip,order_id,qty,note
007,1234567890123456789,2,"Ship, then invoice"
90210,,,"Line one
line two"

What comes out

[
  {
    "zip": "007",
    "order_id": "1234567890123456789",
    "qty": 2,
    "note": "Ship, then invoice"
  },
  {
    "zip": 90210,
    "order_id": null,
    "qty": null,
    "note": "Line one\nline two"
  }
]
  • 007 stays text — as a number it would come back as 7 and stop matching the zip code it came from.
  • 1234567890123456789 is a valid JSON number and still stays text: it is larger than 253, so the parser that reads this JSON hands back 1234567890123456800 instead.
  • Ship, then invoice holds the delimiter inside quotes, and the last field holds a line break inside quotes — two fields, not four, and one record, not two.
  • 90210 has no leading zero, so it does become a number. That inconsistency between two zip codes in one column is real, and it is why the type switch exists.

How to convert CSV to JSON

Three steps: paste the rows, confirm the delimiter and header, set how values are typed.

  1. Paste the rows or open the file

    A .csv, .tsv or .psv of up to 5 MB works, and so does a plain ⌘V, Ctrl+V away from a Mac. A UTF-8 byte-order mark is removed before parsing, and CRLF, LF and bare CR endings are all accepted — the strip above the panels reports which of the three your export actually used, which is often the first surprise.

  2. Confirm the delimiter and the header

    Comma, semicolon, tab and pipe are tested against the first 20 lines and the one that splits them into a consistent number of fields wins; override it if the guess is wrong. Untick “First row is the header” for a file that starts straight into data — the keys then become column_1, column_2 and so on.

  3. Set the typing rules, then copy

    Choose an array of objects or an array of arrays, decide whether empty cells become null, "" or a missing key, and keep type inference on unless every value must stay a string. Every row reaches the clipboard through Copy, and Download writes a .json file carrying the name of the spreadsheet you started from.

Technical specifications

DelimitersComma, semicolon, tab and pipe, detected from the first 20 lines by field-count consistency, or set by hand
QuotingRFC 4180: a field may be wrapped in double quotes and then carry the delimiter, CR, LF or a doubled "" quote; a space before the opening quote is accepted and counted, though the RFC forbids it
Line endingsCRLF, LF and bare CR, counted separately so a mixed file is visible
Type inferenceA cell becomes a number only if it matches -?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)? exactly, so 007, +5, 1,234, 1. and .5 stay text; true and false in three casings become booleans; an empty cell becomes null, "" or a dropped key
Long identifiersIntegers longer than 15 digits stay strings by default: past that length a value can exceed 2^53 = 9,007,199,254,740,992, the last integer an IEEE 754 double holds exactly
Column namesHeader row, or column_1 upward; duplicates become id_2, blanks become column_N, extra fields in a long row become field_N — every rename is listed
Output shapeArray of objects keyed by header, or array of arrays keeping the original column order
Speed, limits and errors60,000 rows of 7 columns (3.56 MB) parse in 0.05 s and reach finished JSON in 0.31 s — an array of objects repeats every key on every row, so that file comes out as 9.28 MB. 5 MB per file; an unterminated quoted field or a stray quote is reported with its line and column; free, no signup, parsed in this tab

Frequently asked questions

How does the converter know which delimiter my file uses?

It parses the first 20 lines four times — once each for comma, semicolon, tab and pipe — and keeps the character that gives every line the same field count. Frequency alone is the wrong test, because one description column full of commas will outvote the semicolons that actually separate the fields in a European export. When no candidate produces a consistent width the comma wins by default and the strip above the panels says so, which is usually the first sign the file is ragged rather than wrongly delimited.

How are commas and line breaks inside a value handled?

They survive, as long as the field is quoted the way RFC 4180 describes. A field wrapped in double quotes may contain the delimiter, a CR, an LF or a quote of its own written twice — so "Doe, John" is one field and "He said ""hi""" carries a literal pair of quotes. This is the whole reason a CSV file cannot be split on commas: the parser here tracks whether it is inside a quoted field, and a line break found there extends the record instead of ending it.

Why does 007 stay a string when 7 becomes a number?

Because the leading zero is data and a number cannot carry it. Zip codes, phone extensions, SKU codes, German postal codes and Dutch bank references all start with zeros that vanish the moment the value becomes numeric, and nothing gets them back. A cell is converted to a number only when it matches the JSON number grammar exactly, which excludes 007, +5, 1,234, 1. and .5 — all of those stay text. The related trap is the long identifier: a snowflake ID such as 1234567890123456789 is a perfectly legal JSON number and comes back from the next parser as 1234567890123456800, because it is larger than 2^53. Digit runs past 15 characters are therefore kept as strings by default.

What should an empty cell become in JSON?

That is your call, because CSV has no way to say it. RFC 4180 gives no null: an empty field and a field containing an empty string are written identically, so ,, could mean "no value", "empty text" or "the exporter had nothing to put here". null is the default here, an empty string is the second option, and the third leaves the key out of the object entirely — which is the right choice when the consumer distinguishes an absent property from a present one.

What happens when a row has more or fewer fields than the header?

Nothing is thrown away and the line number of every mismatch is reported. A short row gets its missing keys filled with the empty-cell value you chose, so every object keeps the same shape; a long row gets its extra values under field_10, field_11 and so on rather than being silently truncated. Ragged rows almost always mean a quote is unbalanced somewhere earlier in the file, so it is worth reading the first reported line rather than accepting the fix.

What if two columns have the same header?

The second becomes id_2, the third id_3, and the renames are listed under the output. A JSON object cannot hold the same key twice in any useful way — every parser keeps the last one — so leaving both named id would delete a column of your data. Blank header cells get column_3 style names for the same reason.

How do I convert JSON back to CSV?

Use json-to-csv.app, which handles the reverse direction properly. Flattening is a harder problem than parsing: a nested object has to become dotted column names, an array of objects has to be turned into rows, and you have to decide what happens to a value that is itself a list. That tool is built around those choices, and this page deliberately does not duplicate it.

About the format that never got a standard

RFC 4180 is the closest thing CSV has to a specification and it is worth knowing what it actually is: an informational memo published in 2005 that describes the common practice it found, not a standard anyone is obliged to follow. It fits on a few pages and says a field may be enclosed in double quotes, that a literal quote inside one is doubled, that fields containing the delimiter, a CR or an LF must be quoted, and that records end with CRLF. It says nothing about character encoding, nothing about types, nothing about null, and nothing about what to do when a row is the wrong length — which is why every exporter behaves slightly differently and why a converter has to expose the decisions rather than bury them.

Typing is where the damage happens, because CSV has no types at all and JSON has six. A converter that calls parseFloat on everything numeric-looking will turn the zip code 02138 into 2138, the phone extension 0044 into 44, the version 1.10 into 1.1 and the account reference +31 into 31. The rule here is deliberately narrow: a cell becomes a number only when it matches the JSON number grammar exactly, and a digit run longer than 15 characters is kept as text even though it qualifies, because beyond that length an IEEE 754 double cannot represent the integer and the next parser to touch it will change the value. Everything else stays a string, and if you want the raw shape with no inference at all, turn the switch off and inspect the result in the JSON viewer.

The other half of the job usually lives elsewhere. If you want to read and sort the rows before converting anything, the CSV viewer loads the same file into a table with the delimiter detected the same way. If your rows started life as XML rather than a spreadsheet, converting the tree straight to rows with XML to CSV skips a step. And for the reverse of this page — JSON back into rows — use json-to-csv.app, which is built around the flattening decisions that direction needs.

Where the rows are read

The file never leaves your machine: it is read through the browser File API and parsed by JavaScript in this tab, with no upload and no logging. That is what makes it reasonable to paste an export full of customer names and addresses here rather than into a service that keeps a copy.