CSV to JSON
- 62 tools
- No watermark
- No daily limit
JSON from a CSV file or pasted text: an array with one object per row, keyed by the header row, or an array of arrays if the file has no header. Every value stays text unless you ask for numbers, and even then only a value that comes back exactly as it was written becomes one, so 0812345678 keeps its leading zero, 007 stays 007, and 12.50 is not trimmed to 12.5. Thai from Excel is read in whatever encoding Excel used. Nothing leaves your browser.
1 · The CSV
2 · Options
Turn this off if the first row is data.
Only a value that comes back exactly as written: 42 and -3.5, but not 007, 0812345678, 1,234 or 12.50.
An example
This CSV:
name,phone,city
Somchai Jaidee,0812345678,"Chiang Mai, Chang Khlan"
Mali Rakthai,0898765432,Phuket
becomes:
[
{
"name": "Somchai Jaidee",
"phone": "0812345678",
"city": "Chiang Mai, Chang Khlan"
},
{
"name": "Mali Rakthai",
"phone": "0898765432",
"city": "Phuket"
}
]
What the numbers option does to each kind of value
| In the CSV | Option off | Option on |
|---|---|---|
300 | "300" | 300 (a number) |
-45.5 | "-45.5" | -45.5 (a number) |
0812345678 | "0812345678" | "0812345678" (stays text) |
007 | "007" | "007" (stays text) |
12.50 | "12.50" | "12.50" (stays text) |
1,250.00 | "1,250.00" | "1,250.00" (stays text) |
1234567890123456 | "1234567890123456" | "1234567890123456" (stays text) |
A value becomes a number only if JSON would give it back exactly as it was written. A leading zero, a trailing zero, a thousands separator or more digits than a JSON number can hold all keep it as text.
Frequently asked questions
What does the JSON look like?
An array with one object for each row, and in each object the column headers are the keys: [{"name": "Somchai", "phone": "0812345678"}, …]. If the first row is data rather than names, untick that option and you get an array of arrays instead, one per row, which keeps every value in its place without inventing names for the columns.
Why are my numbers in quotation marks?
Because a CSV does not say which values are numbers, and guessing is how data gets damaged. A phone number 0812345678 read as a number is 812345678; a product code 007 becomes 7; 12.50 becomes 12.5. So every value stays text unless you tick the option, and with it ticked only a value that would come back exactly as it was written is turned into a number. If a column holds identifiers, such as ID card numbers, leave the option off even when they happen to have no leading zero.
What happens to column names that repeat or are empty?
A JSON object cannot have the same key twice, so a second column called Phone becomes Phone_2, and a column with no header becomes column_3. Everything else is kept exactly as typed, including spaces and Thai, because JSON keys can be any text. The page lists every name it changed.
What about empty cells?
An empty cell is an empty string, "". It is not marked as missing, because a CSV has no way to tell an empty value from a missing one, and marking it would be a guess. A row shorter than the header gets empty strings for the columns it lacks, so every object has the same keys.
My CSV has Thai in it. Will it come out right?
Yes. The encoding is measured rather than guessed: UTF-8, UTF-8 with a byte-order mark, Windows-874 (what Excel writes on a Thai computer) and UTF-16 (Excel’s "Unicode Text") are all recognised. JSON is always UTF-8, and Thai is written as Thai, not as \u0e0a escapes, so it stays readable.
Is my file uploaded?
No. Your browser reads the CSV and writes the JSON. The site’s security policy sets connect-src ‘none’, so the browser blocks network requests from these pages, so nothing could be sent even if the code tried. A customer list or a payroll export should not be handed to a website to be converted.
How large a file can it take?
Any size. The file is read a piece at a time and the JSON is written a piece at a time, so a file larger than your computer’s memory is fine. The page shows the first 200 KB of the result; the download has all of it.
Can I check or reformat the JSON afterwards?
Yes. The JSON Formatter on this site checks it and reformats it, and says exactly where a problem is if there is one. The JSON and XML page turns it into XML.