How to convert CSV to JSON without losing IDs
Handle quoted commas, choose the right delimiter, and keep spreadsheet identifiers as strings when converting CSV to JSON.
Open CSV to JSONA CSV can look perfect in a spreadsheet and still need a few decisions before it works as JSON. The converter needs to know which row contains the column names, which character separates fields, and whether values that look numeric should become numbers.
Try a small sample
Paste this sample into CSV to JSON:
item_id,name,stock,active
10042,"Notebook, ruled",12,true
10043,Pencil set,8,false
The quotes around Notebook, ruled keep the comma inside the name. Without quotes, that comma would create another field. Keep First row is a header selected so each row becomes an object with keys such as item_id and stock.
Decide what should stay as text
With Convert numbers and true/false enabled, this sample produces the number 10042, the number 12, and the boolean true in the first object. If an API expects an identifier such as "10042", that numeric ID is the wrong type even though it looks the same on screen.
Turn the option off to preserve every field as text, then convert only the columns that actually need numbers or booleans in your own code. This is especially useful for long identifiers that can exceed JavaScript’s exact integer range. If your spreadsheet already removed leading zeros before exporting, correct the source or recover the original export. The JSON conversion cannot recover missing digits.
Troubleshoot and check the output
If each record has one huge field, select the correct delimiter instead of relying on automatic detection. Some spreadsheet exports use semicolons or tabs. Make header names unique before converting so two columns do not compete for the same JSON key.
Select Convert, then Copy or Download .json. Open the result in JSON Formatter to inspect its structure, and compare the first and last records with the spreadsheet before importing the full file.
Preserve empty fields on purpose
An empty field, an omitted key, and a JSON null can mean different things to an API. For example, an empty second column might mean a contact number is unknown, while omitting the key might tell an update endpoint to leave the old number alone. Agree on that distinction before importing. Use a test record with an empty value and compare the resulting JSON with the receiving system’s sample.
Keep a second test row with a zero value. In inventory data, zero stock is a real value rather than a missing quantity. A conversion script that replaces all falsy values with null would destroy that distinction. It is easier to spot with two hand-checked records than after a full import.
Check a representative set of rows
Pick one ordinary row, one with a quoted comma, one with an empty field, and one with a zero-prefixed identifier. If the export contains names with accents or other scripts, include one of those too. Compare the resulting keys with your expected schema, then compare the values and types one by one.
For a repeatable import, write down the delimiter, encoding, header names, and the fields that should become numbers. Save the original CSV alongside the output. If the source changes later, the notes help you find whether the issue came from the export or the conversion. Our CSV to JSON converter comparison shows when it makes sense to move this process into code.
Ready to try it?
CSV to JSON is free to use and runs in your browser.
Try CSV to JSON