This converts comma separated values into a JSON array of objects, using the first row as field names for every row after it. It's a quick way to reshape simple tabular data into what most APIs and JavaScript expect, without opening a spreadsheet program.
How to use it
- Paste your CSV data in, with the first row as column headers.
- Click convert.
- Review the JSON array in the output box.
- Check each object's fields match the expected headers.
- Copy the JSON for your code or API request.
When it helps
- Turning a spreadsheet export into JSON for a JavaScript app or a mock API.
- Preparing sample data for a coding project from a CSV file.
- Converting a small CSV dataset into JSON for a tool that only accepts JSON.
- Checking how a CSV file's structure will map onto object fields before writing a full import script.
- Sharing tabular data with a developer in the format they need.
Good to know
- Make sure the first row has clear, consistent headers, since they become the JSON keys directly.
- This converter splits on plain commas, so avoid commas inside a field value unless your data quotes them carefully.
- Check the output for misaligned fields if a row has a different number of columns than the header.
- Check for a blank line at the end of your CSV before converting, since a trailing empty line can sometimes produce an unwanted empty object in the result.
- If your CSV came from Excel, check for any stray formatting artifacts, like currency symbols mixed into a numeric column, before converting, since those will carry straight into the JSON as text.
Checking the output
After converting, paste the JSON into a validator or the JSON Compare tool alongside a sample you trust. Look at empty cells and numbers with leading zeros, which are common sources of surprises.
Questions
Does this handle commas inside quoted fields?
It splits on commas directly, so a CSV with commas embedded in quoted fields might not convert perfectly and could need manual fixing.
What happens if a row has fewer columns than the header?
The resulting object will have undefined values for the missing fields, worth checking for before using the data further.
Can I convert the JSON back to CSV?
Yes, use the JSON to CSV tool to go the other direction.
Can I convert a CSV file directly instead of pasting it?
This works with pasted text. Open the file in a text editor or spreadsheet, copy its contents, and paste them here.
Will numbers become JSON numbers or stay as text?
Every value becomes a text string by default, so numeric looking values appear in quotes in the output. You'd adjust it manually if your application needs actual numeric types.
Does this trim extra spaces around values automatically?
It trims spaces around each header and value as part of the conversion, which helps avoid a mismatch caused by inconsistent spacing in the original CSV.