Convert CSV and JSON without losing data
Paste CSV or JSON, or open a file, and get the other format at once. Values stay as text unless you ask otherwise, so ZIP codes, phone numbers and long IDs are not mangled, and the tool tells you about anything that could not be kept exactly. Nothing is uploaded.
Options
Result
Paste something or open a file to convert it.
Nothing leaves your browser. A pasted or opened file is read and converted on this page only.
How it works, and what can go wrong
- •The CSV reader follows RFC 4180: quoted cells can hold commas, doubled quotes and line breaks, and CRLF, LF and CR line endings all work. A byte order mark at the start is removed.
- •The delimiter (comma, semicolon, tab or pipe) is detected from the first rows. You can override it, and rows with too many or too few cells are listed by row number.
- •Every value is kept as text by default. 02134, 1E5 and a long order number would all change if turned into numbers. The optional detection only converts a value when it reads back as exactly the same text, and it tells you which values it left alone.
- •Converting to JSON is not always reversible: CSV has no null, no nesting and no types. The round-trip check converts there and back and lists every cell that changed.
- •Converting JSON to CSV keeps the columns in the order the keys are written. Numbers that JavaScript cannot hold exactly (too many digits, too large or too small) and keys repeated in one object are reported. One thing is not kept: inside a nested value written as JSON text, keys that are whole numbers, such as "2" and "1", come first and in numeric order, as in JavaScript.
- •Opening a CSV in a spreadsheet can run cells that start with = + - or @ as formulas. The optional protection adds a single quote in front of such text cells. It is off by default because it changes your data.
Questions
- Is my data uploaded?
- No. The conversion runs inside this page in your browser, and the file you open is read locally. Files up to 5 MB are accepted.
- Why are numbers written as text in the JSON?
- Because CSV does not say what is a number. A ZIP code like 02134, a phone number or a code like 1E5 looks numeric but is an identifier. Turn on number detection when you know the column is really numeric.
- Why do I see a warning about large numbers?
- JSON numbers are read as 64-bit floating point, which holds whole numbers exactly only up to 9,007,199,254,740,991. Longer IDs are rounded before any tool can see them, so store them as text in your JSON.
- Excel shows strange characters. What do I do?
- Turn on the byte order mark option when converting to CSV. Excel then reads the file as UTF-8 and shows accents and non-Latin text correctly.