JSONGenerator
GeneratorSchemaConvertersExamplesDocs

JSONGenerator

Free online tools for generating random JSON data and JSON Schemas.

Quick Links

  • JSON Generator
  • JSON Schema Converter
  • Examples
  • Docs
  • Blog
  • About
  • Contact
  • Privacy Policy

Converters

  • JSON to YAML
  • YAML to JSON
  • XML to JSON
  • JSON to XML
  • JSON to TOML
  • TOML to JSON
  • JSON to CSV
  • CSV to JSON
  • JSON to Excel
  • Excel to JSON
  • JSON to HTML table
  • JSON to TypeScript
  • JSON to C#
  • JSON to Go
  • JSON to Java
  • JSON to SQL

Support

Having issues? Contact us.

© 2026 JSON Generator. All rights reserved.

CSV to JSON Converter

Paste CSV or TSV and get a clean JSON array as you type.

Swap directionSwap direction

CSV Input

Paste CSV, upload a .csv or .tsv file or drop one here.

1
2
3
4
id,name,price,in_stock,zip,order_id,address.city,notes
1,Desk lamp,24.90,true,02134,9007199254740993,Boston,"Warm light, dimmable"
2,Standing desk,399,false,10001,9007199254740994,New York,"Described as ""quiet"" by the maker"
3,Cable tray,4.50,true,94103,9007199254740995,San Francisco,

JSON Output

Updates as you type. Copy it or download a .json file.

1

Converting…

Convert CSV to JSON online

This free CSV to JSON converter turns comma-separated values into a formatted JSON array. Paste an export from a database or spreadsheet, or drop in a .csv or .tsv file, and the JSON appears as you type. Each row becomes an object keyed by your column names, ready to use in an API request, a test fixture or a JavaScript app. Nothing is uploaded: the conversion runs in your browser.

CSV is the format every spreadsheet and database can export, but code usually wants JSON. The conversion looks simple until real files get involved: quoted commas, multi-line cells, semicolon delimiters from European locales, ZIP codes that start with zero, and IDs too long for a JavaScript number. This converter handles those cases deliberately, and the sections below explain exactly how.

How to convert CSV to JSON

  1. Paste your CSV into the CSV Input editor, or click the upload button to open a .csv, .tsv or .txt file. You can also drag a file onto the editor.
  2. The JSON Output updates as you type. If a quote is left open, the status bar names the row so you can find it.
  3. Choose your options: untick First row is header if your file has no column names, untick Convert numbers and booleans to keep every value as text, or tick Nest dot-notation columns to build nested objects.
  4. Click Copy to put the JSON on your clipboard, or Download to save it as data.json.

CSV to JSON example

The header row supplies the keys. Numbers and booleans become real JSON values, the quoted cell keeps its comma, and the ZIP code with a leading zero stays a string.

CSV input
id,name,price,in_stock,zip
1,Desk lamp,24.90,true,02134
2,"Standing desk, oak",399,false,10001
JSON output
[
  {
    "id": 1,
    "name": "Desk lamp",
    "price": 24.9,
    "in_stock": true,
    "zip": "02134"
  },
  {
    "id": 2,
    "name": "Standing desk, oak",
    "price": 399,
    "in_stock": false,
    "zip": 10001
  }
]

Notice that 10001 became a number while 02134 did not. Conversion is decided cell by cell, so a column that mixes both will come out mixed. If a column is an identifier rather than a quantity, untick Convert numbers and booleans and all values stay strings.

How CSV values map to JSON

How each kind of CSV cell is written in JSON
CSV cellJSON outputNotes
Ada"Ada"Text is always a string.
42, -7, 3.1442, -7, 3.14Plain decimal numbers become numbers when the option is on.
true, FALSEtrue, falseCase-insensitive. Other words such as yes or no stay strings.
02134"02134"Leading zeros stay, so ZIP codes and phone numbers survive.
(empty cell)""Empty cells become empty strings, never null.
"a, b""a, b"A doubled quote ("") inside a quoted cell becomes one quote.

Large IDs and leading zeros stay as strings

JavaScript stores numbers as 64-bit floats, so integers above 9,007,199,254,740,991 (253 minus 1) silently lose their last digits when parsed. A 16-digit order ID such as 9007199254740993 would come back as 9007199254740992. The converter checks each integer and keeps it as a string when it is not safe, and it also keeps decimals with more than 15 significant digits as strings. Forms such as +1, 1e5, .5 and 1,000 are left as text too, because they are not plain JSON numbers.

Delimiters, quotes and line breaks

The delimiter is detected from the first rows: comma, tab, semicolon or pipe. Fields in double quotes can contain the delimiter, doubled quotes and line breaks. Blank lines and rows with only empty cells are skipped, and a byte order mark at the start of the file, which Excel adds when it saves "CSV UTF-8", is removed. If a quote is opened and never closed, or a closing quote is followed by more text, the converter stops and reports the row instead of guessing.

Duplicate, empty and missing columns

Every key in a JSON object must be unique, so the converter makes header names unique in a predictable way. Repeated names are numbered in order: tag,tag,tag becomes tag, tag_2 and tag_3. An empty header becomes column_ plus its position, so the second column is column_2. Whitespace around header names is trimmed. A row with fewer cells than the header gets empty strings for the missing ones, and a row with extra cells gets column_N keys, so no data is dropped.

Nested objects from dot-notation columns

CSV is flat, but JSON often is not. Tick Nest dot-notation columns and a header like address.city is written as a nested object. This matches how the JSON to CSV converter names flattened columns, so nested data can make a round trip.

CSV input
name,address.city,address.zip
Ada,Boston,02134
JSON output
[
  {
    "name": "Ada",
    "address": {
      "city": "Boston",
      "zip": "02134"
    }
  }
]

If one column name is the parent of another, such as a and a.b, nesting would overwrite a value, so both columns keep their literal names. The same applies to names with an empty part, such as .a or a..b.

Dates and other text stay text

CSV has no data types: every cell is text until something decides otherwise. This converter only promotes plain numbers and true or false. Dates such as 2025-03-14 or 3/14/2025, currencies such as $1,200 and percentages are left exactly as written, because guessing a date format wrongly is worse than leaving a string for your code to parse.

Arrays of arrays when there is no header

If the file has no column names, untick First row is header. The output is then an array of arrays, one per row, in the same order as the file. Number and boolean conversion still applies, but there are no keys, so nesting does not.

Getting a clean CSV out of Excel or Google Sheets

In Excel, use Save As and pick CSV UTF-8 (Comma delimited). In Google Sheets, use File, Download, then Comma-separated values. Uploaded files are read as UTF-8, so these exports keep accents and symbols intact, while older "CSV (Comma delimited)" files saved in a Windows code page can show garbled characters. Excel in some locales separates values with semicolons because the comma is its decimal mark; that works without changing anything.

CSV or JSON: which should you keep?

CSV is compact and opens in every spreadsheet, which makes it good for flat tables that people edit. JSON carries types, nesting and arrays, which makes it the better fit for APIs, configuration and anything a program reads. Keep the CSV as the file people edit and convert it to JSON whenever code needs it; the conversion is instant and repeatable.

Why convert CSV to JSON?

  • API payloads and fixtures: Turn a spreadsheet of test records into the JSON body or mock data your service expects.
  • Front-end data: Load a CSV export into a JavaScript or React app without writing a parser.
  • Database seeding: Convert exported rows to JSON for MongoDB, Firestore or a seed script.
  • Data pipelines: Many tools and queues expect JSON, while the source system only offers CSV.
  • Config and lookup tables: Maintain a list in a spreadsheet and ship it as a JSON file.

Working in Excel? Use the Excel to JSON converter to read an .xlsx file directly, or try the JSON to SQL converter to load the result into a database. To go the other way, use the JSON to CSV converter. Need test data first? Create it with the JSON Generator, describe the result with the JSON Schema generator, or read how to seed test databases in CI/CD.

Frequently Asked Questions

How do I convert a CSV file to JSON?

Paste your CSV into the CSV Input editor, or upload or drop a .csv or .tsv file. The JSON appears in the output editor as you type. Click Copy, or Download to save it as data.json.

Does CSV to JSON need a header row?

No. With First row is header ticked, each row becomes an object keyed by the column names. Untick it and every row becomes a plain array of values, which is the right choice for data that has no column names.

Why does my ZIP code or ID keep its leading zero?

With Convert numbers and booleans on, a cell becomes a JSON number only if that changes nothing. Values with leading zeros such as 02134, and integers too large for JavaScript to store exactly, stay strings. Untick the option to keep every value as a string.

Can the converter handle semicolon or tab separated files?

Yes. It detects commas, tabs, semicolons and pipes from the first rows of your data, so TSV files and European-style semicolon CSV exports work without any setting. Quoted fields can contain the delimiter and line breaks.

How do I get nested JSON from a CSV file?

Tick Nest dot-notation columns. A header such as address.city then becomes {"address": {"city": ...}}. This is the same naming our JSON to CSV converter produces, so nested data survives a round trip.

What happens to duplicate or empty column names?

Repeated names are numbered in order (tag, tag_2, tag_3) and empty names become column_2, column_3 and so on, using the column position. That way no column is lost and every key in the JSON is unique.

Is my CSV data uploaded to a server?

No. The conversion runs entirely in your browser with JavaScript, so your file never leaves your device. That makes it safe for exports that contain customer or internal data.

Related converters

  • JSON to CSV ConverterConvert a JSON array to CSV, with nested objects flattened into columns.
  • JSON to Excel ConverterConvert JSON to an Excel .xlsx spreadsheet you can open in Excel, Numbers or Google Sheets.
  • Excel to JSON ConverterConvert an Excel .xlsx, .xls or .ods sheet, or pasted cells, to JSON.
  • JSON to HTML Table ConverterConvert a JSON array to an HTML table you can paste into a page or email.
  • JSON to YAML ConverterConvert JSON to clean, readable YAML for config files, Kubernetes and CI pipelines.
  • YAML to JSON ConverterConvert YAML, including anchors and multi-document files, to formatted JSON.

See all JSON converters