CSV ⇄ JSON
Convert between CSV and JSON, from text or a file.
About CSV ⇄ JSON
Convert CSV to a JSON array of objects, or JSON to CSV, in the browser. Nested objects become dot-joined column names and are rebuilt on the way back.
How to use
- Paste CSV (the first row is the header) or JSON, or load a
.csv,.tsvor.jsonfile up to 5 MB. The delimiter (comma, semicolon or tab) is detected, or pick one. - Input that starts with
{or[is treated as JSON and converted to CSV; anything else is read as CSV. Use the Auto / CSV → JSON / JSON → CSV switch to force a direction. - The output updates as you type. Copy it, or Download it as
.jsonor.csv.
Rules
- CSV → JSON produces an array with one object per data row. Every value is a string unless "Infer numbers and booleans" is ticked; an empty cell becomes
nulland blank lines are skipped. A column namedaddress.citybecomes{ "address": { "city": … } }, so.in a header is read as a nesting separator. A cell holding a JSON array such as["a","b"]becomes an array. - Parsing follows RFC 4180 (papaparse): a field wrapped in double quotes may contain the delimiter and line breaks, and
""inside quotes is one quote. - JSON → CSV accepts an object or an array of objects. Nested keys are joined with
.to make a column, and an array inside a record is written as JSON text in one cell, so a record never becomes several rows. - Values containing the delimiter, a quote or a line break are quoted and inner quotes doubled.
Example
id,name,address.city
1,Ada,London
→
[
{
"id": "1",
"name": "Ada",
"address": { "city": "London" }
}
]
Privacy
Conversion runs in the page. A dropped file is read locally, no request is made, and nothing is stored.
Frequently asked questions
- How do I convert CSV to a JSON array of objects?
- Use the first row as the header: each header cell becomes a key and each later row becomes one object. That is the mapping this converter applies, with every value kept as a string.
- How is nested JSON represented in CSV?
- CSV is flat, so nested keys are joined into one column name. XUtil uses a dot: {"address": {"city": "London"}} becomes a column called address.city, and the same column turns back into the nested object. Arrays are written as JSON text in one cell.
- Why are all my numbers strings after converting CSV to JSON?
- CSV has no types; every cell is text. By default the converter does not guess, because a postcode like 01234 or an ID like 1e5 would be corrupted by automatic number conversion. Tick "Infer numbers and booleans" to convert cells that look like numbers, true or false.
- What is RFC 4180?
- RFC 4180 is the informal standard for CSV: comma-separated fields, CRLF line endings, optional header row, and double quotes around fields that contain commas, quotes or line breaks. Most spreadsheet exports follow it; tab and semicolon separated files are detected and handled too.