Skip to content
DDevToolery

CSV to JSON

Parse delimited text into JSON, with real quote handling.

Loading tool…

About this tool

Parses delimited data properly — quoted fields containing commas, escaped quotes and embedded newlines all handled — and emits an array of objects keyed by the header row. Type inference is optional, because a CSV file never recorded what its types were and guessing is sometimes wrong.

Limitations

  • Type inference is a guess. A column of ZIP codes will happily become numbers if you let it.

Questions

Why did my ID lose its leading zeros?
Type inference turned it into a number. Postcodes, phone numbers and zero-padded identifiers should stay text — switch inference off and every value stays a string.
The whole file landed in one column.
The delimiter guess was wrong. Files exported from Excel in European locales use semicolons. Set the delimiter explicitly rather than leaving it on automatic.
The first key has strange characters in it.
That is a byte order mark, which Excel writes at the start of UTF-8 files. It becomes part of the first header name, so lookups against it fail even though the text looks identical.

Privacy

This page does its work in your browser. What you paste is processed by JavaScript running on your own device and is never sent to a DevToolery server — there is no server that could receive it. The page itself is a static file delivered by a CDN. See exactly what is stored.