Convert CSV to JSON
Turn a comma-separated table into a JSON array of objects without sending the rows to a server. The parser understands quoted commas, quoted line breaks, escaped quotation marks, alternate delimiters, and uneven rows. The first row becomes the field names and every later row becomes one JSON object, so the result is ready for an API fixture, a script, or a small data import. Values remain strings deliberately: converting an account number into a number can remove leading zeroes, while converting a status such as "001" changes data.
Use this without the search next time. Prathom Workbench puts Prathom's tools in your toolbar.
Add to Chrome — freeWhat it does
- Quoted commas, line breaks, and escaped quotes
- Comma, semicolon, tab, and pipe delimiters
- Unique field names for blank or repeated headers
- JSON array output, pretty or compact
- Copy and download actions
How to use CSV to JSON
- 1
Paste the CSV
Paste the header row followed by records into the input area. The first row supplies JSON property names, while every subsequent row becomes one object.
- 2
Choose the delimiter
Select comma, semicolon, tab, or pipe when the source is not ordinary comma- separated data. Quoted separators inside a field are kept as part of that field.
- 3
Review the objects
Check the row and column counts, then inspect the generated JSON. Blank headers receive column names and repeated headers receive a numeric suffix rather than silently overwriting an earlier value.
- 4
Copy or download
Copy the formatted array into a script or download it as text. Keep the source CSV when the conversion is part of a regulated or repeatable import process.
How it works
Check types after conversion
CSV has no native type system, so values such as 00123, dates, and empty cells need a
deliberate interpretation in the receiving application. Check whether identifiers must
remain strings and whether every row has the same number of columns. Review the first,
middle, and final records and keep the original CSV. The converter creates JSON shape
from tabular text; it does not validate dates, currencies, identifiers, or domain rules.
Mapping CSV fields to JSON
The first row is normally used as the object-key header, so duplicate or empty column names deserve attention before conversion. Keep an eye on numeric-looking values, leading zeroes, empty cells, quoted commas, and multiline fields because JSON consumers may interpret them differently. Validate a representative object and the final object after download, especially when the CSV feeds an API or script. Conversion changes the container format; it does not validate the business meaning of each column.
The converter reads the first row as a header vector and the remaining records as rows. It does not split the source with a simple comma expression. Instead, it tracks whether the current field is inside double quotes, recognizes doubled quotes as an escaped quote, and treats both Unix and Windows line endings as row boundaries. That matters for addresses, descriptions, and notes that contain punctuation or copied line breaks.
Rows shorter than the widest row are padded with empty strings. A header is trimmed for use as a property name; blank and duplicate names are made unique so JavaScript object creation cannot silently lose a column. The output is indented JSON with one object per input row. Nested objects are not inferred from dotted column names, and CSV values are not guessed into numbers or booleans.
When to use it
Use CSV to JSON when a spreadsheet export needs to become test data, a small API payload, a configuration fixture, or input for a script. It is also useful before writing a schema because the object shape makes missing fields visible. For large datasets, validate a sample here and use a streaming parser in your production pipeline. Preserve the original CSV when a later import needs exact formatting, encoding, formulas, or spreadsheet metadata that JSON cannot represent.
Examples
Exporting a contact list for an API fixture
The boolean-looking active value remains the string "true". That is safer for general CSV work because CSV has no universal type system and a downstream application may need to distinguish text, numbers, and flags itself.
Keeping a comma inside an address
The comma inside the quoted address is not treated as a new column. This is the common reason a quick split-on-commas script creates shifted fields.
Frequently asked questions
Does CSV to JSON convert numbers and true or false values automatically?
No. Every CSV cell is emitted as a JSON string, including values that look like numbers, booleans, dates, or null. CSV has no shared type declaration, and automatic coercion can destroy leading zeroes in IDs or change dates. Apply an explicit schema in the program that owns the import when typed values matter.
Can it handle commas and line breaks inside quoted CSV fields?
Yes. The parser treats a double-quoted field as one value until its closing quote, so commas and line breaks inside that field are preserved. A literal quote is written as two quotes in CSV and is converted back to one quote in the JSON string. An unmatched opening quote is reported instead of guessing.
What happens when CSV headers are blank or repeated?
Blank headers receive names such as column_1, based on their position. Repeated names receive a suffix such as email_2 so that no property is silently replaced in the generated object. Review those names before sending the JSON to an API whose schema expects particular property spelling.
Is my CSV uploaded during conversion?
Yes. The pasted rows are sent to our server, parsed there, and the result returned; nothing is stored and there is no account. A browser extension, clipboard manager, screen recorder, or your own download folder can still expose data, so use the same care you would use for any sensitive spreadsheet.
Further reading
- The Same Table Was Three Times Bigger as JSONCSV writes each column name once, at the top. JSON writes it again on every single row. On a table of any size that is not a subtlety — it is the dominant term, and it explains both why the conversion inflates and why it barely matters over the wire.
- Compressed, Base64 Cost Nothing on a JPEG and 17% on JSONBase64 costs a third, and almost everything it travels over is compressed, so the real question is what survives the compressor. The answer is not one number: on already-compressed data the overhead vanishes, and on compressible data a sixth of it stays.
- Minifying JSON Saved 36%, and 3.7% Once It Was CompressedMinifying JSON is standard advice and the raw saving is large enough to make it look obviously correct. Almost everything that carries JSON compresses it first, and once you measure the compressed sizes the case mostly disappears.