FLXCode CSV to JSON

FLXCode apps

Appearance

CSV to JSON

Paste CSV, get JSON. The delimiter is found for you and codes like 00123 are not turned into numbers. It stays in your browser.

Stays in this page. Nothing is saved, shared or sent. Text up to 1 MB. For larger files use Open file (up to 50 MB).

JSON result
[
  {
    "id": "00123",
    "name": "Ann Lee",
    "city": "Kraków",
    "score": "4.5"
  },
  {
    "id": "00124",
    "name": "Bo \"B\" Smith",
    "city": "Łódź",
    "score": "3"
  },
  {
    "id": "12345678901234567890",
    "name": "Cy",
    "city": "Gdańsk, PL",
    "score": ""
  }
]

Converted. 3 objects with 4 columns. Delimiter: comma (detected).

No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it. What this tool keeps and sends.

Problem or idea? Email us

Quick start

  1. Paste CSV in the left box, or choose Open file. A small sample is already there.
  2. The JSON appears on the right. The status line tells you which delimiter was found.
  3. Choose whether the first row is a header, and whether numbers should become numbers.
  4. Copy it, or download converted.json.

To check or reformat the result, use the JSON formatter. The other direction is JSON to CSV. To get a CSV into a real Excel file with the zeros and dates kept, use CSV to Excel.

Worked examples

Each result below was made by the same code as the tool, when this page was built (minified to fit).

Codes and long ids stay text

CSV

zip,id,qty
00123,12345678901234567890,7

JSON

[{"zip":"00123","id":"12345678901234567890","qty":7}]

A semicolon file, found by itself

CSV

name;price
Tea;3
Coffee;4

JSON

[{"name":"Tea","price":"3"},{"name":"Coffee","price":"4"}]

A quoted comma, quote and line break

CSV

note
"a, ""b""
c"

JSON

[{"note":"a, \"b\"\nc"}]

Dot-path columns become nested objects

CSV

id,user.name,user.city,tags.0,tags.1
1,Ann,Kraków,red,blue

JSON

[{"id":"1","user":{"name":"Ann","city":"Kraków"},"tags":["red","blue"]}]

A short row and a long row

CSV

a,b,c
1,2
1,2,3,4

JSON

[{"a":"1","b":"2","c":""},{"a":"1","b":"2","c":"3","column_4":"4"}]

Empty cells as null

CSV

a,b
1,
,2

JSON

[{"a":"1","b":null},{"a":null,"b":"2"}]

What it does with your cells

  • Quoted fields can hold the delimiter, doubled quotes and line breaks. A quote that never closes is an error, with its line.
  • A byte order mark at the start is ignored. CRLF and LF both work.
  • With "Numbers and true/false" the values true and false and plain numbers are written without quotes. Numbers are copied as written, so 1.0 stays 1.0. Leading zeros, plus signs and more than 15 digits stay text.
  • With the header switched off you get an array of arrays, no keys.
  • A header name used twice gets a suffix: a, a_2.

Limits

  • No dates, no locale numbers, no currency. A value is text, a plain number or true/false.
  • Input is read as UTF-8. The page cannot tell another encoding from broken text.
  • The delimiter guess can be wrong on a file with one column or very few rows. Choose it by hand then.
  • No .xlsx input. Save the sheet as CSV first.

How it works and privacy

A small parser follows RFC 4180, builds each row as an object and writes the JSON text itself, so a number is never converted and cannot lose digits. The indentation comes from the same code as the JSON formatter. Files go to a background worker. We count events without cookies, like "download used" (details). Your data is never part of them.

FAQ

How does it know the delimiter?

It tries comma, tab, semicolon and pipe on the first rows and takes the one that gives the same number of fields on most rows. Comma wins a tie. If it picks wrong, choose the delimiter by hand. Excel in many European countries saves with semicolons.

Why is 00123 still text with "Numbers and true/false" on?

A number with a leading zero is usually a code, like a zip code or a product id, and 123 would lose the zeros. The same goes for numbers with more than 15 digits: JSON readers turn them into floating point and change the last digits. Those stay text. Plain numbers like 4.5, -3 or 1e5 become numbers. By default everything stays text.

What about 1,5 as a decimal number?

It stays text. The page does not guess a locale. If your numbers use a decimal comma, convert them first or read them as text in your program.

How do the nested objects work?

Tick the box and a column named user.city goes into {"user": {"city": ...}}. Columns tags.0 and tags.1 become an array. A column that clashes with another one (x and x.y) stays as a plain key, and the status line says so.

What if rows have different numbers of cells?

A short row is filled with empty values. A longer row gets extra keys named column_4, column_5 and so on. The status line counts how many rows were changed. Blank lines are skipped. Empty or repeated header names are renamed.

My file shows odd characters like �.

The page reads the file as UTF-8. A file saved as Windows-1250 or 1252 is not UTF-8, so letters like ł or é break. Save it again as "CSV UTF-8" in Excel, or convert it in a text editor.

More from FLXCode

  • JSON to CSVTurn JSON into CSV for Excel or Sheets. Nested objects get dot paths, big numbers stay exact, nothing is uploaded.
  • CSV to Excel ConverterTurn CSV files into an Excel .xlsx file. Leading zeros, long numbers and dates stay as they are. Nothing is uploaded.
  • JSON FormatterFormat, minify, sort and check JSON in your browser. Big numbers stay exact and errors show line and column.
  • Regex TesterTest JavaScript regular expressions with live matches, groups, flags and a replace preview. Runs in your browser.

Share CSV to JSON