CSV to JSON Converter

Convert CSV to JSON, JSON to CSV, and Excel to either, right in your browser. Multi-sheet .xlsx support, row and column counts, copy or download results.

Advertisement

Convert CSV to JSON, JSON to CSV, and Excel to Either

Paste your data or upload a file and this converter transforms it as you type. Six conversions are supported in both directions across three formats: CSV to JSON, JSON to CSV, Excel to JSON, Excel to CSV, CSV to Excel, and JSON to Excel. It reports how many rows and columns it parsed, flags malformed input with a specific error rather than failing silently, and lets you copy the result or download it as a .json, .csv, or .xlsx file. All parsing happens in your browser — no file ever leaves your machine, which matters when the spreadsheet contains customer records, exported logs, or anything else you are not allowed to upload to a third-party service.

Who This Is For

The conversion between tabular and hierarchical formats is a daily chore in a few specific jobs. Developers seeding a test database from a spreadsheet a colleague sent. Analysts pulling an API response into something Excel can pivot. Sysadmins turning an exported user list into JSON for a bulk provisioning script. Anyone who has been handed a .xlsx file and needs the data in a format a program can read. This tool is built to do that in a few seconds without installing a library or writing a throwaway script.

How to Use It

  1. Pick a conversion. The six mode buttons at the top set both the input format and the output format. Switching modes clears the workspace so you never convert stale input.
  2. Provide your data. For CSV and JSON you can paste directly into the input box or use Upload File. For Excel input you must upload a .xlsx or .xls file, since a spreadsheet is binary and cannot be pasted as text.
  3. Choose a sheet. If the workbook has more than one sheet, a selector appears and you can convert any of them. The first sheet is used by default.
  4. Check the row and column counts. These appear above the panes as soon as parsing succeeds and are the fastest sanity check that the file was read the way you expected.
  5. Copy or download. Text output can be copied to the clipboard or downloaded with the right extension. Excel output is generated as a real .xlsx workbook when you click Download Excel.

A Load Sample button fills in a small four-column example for the CSV and JSON modes if you want to see the shape of the output before committing your own data.

How CSV to JSON Conversion Works

The converter treats the first row of your CSV as the header row and uses those values as JSON object keys. Each subsequent row becomes one object in an array. Header names are trimmed of surrounding whitespace, which quietly fixes the single most common cause of mismatched keys — a stray space after a comma in the header line.

Given this CSV:

name,age,city
John Doe,30,New York
Jane Smith,25,London

You get:

[
  { "name": "John Doe", "age": "30", "city": "New York" },
  { "name": "Jane Smith", "age": "25", "city": "London" }
]

Note that age comes out as the string "30", not the number 30. That is deliberate and worth understanding: CSV has no type system. Every field is text, and any conversion of “looks like a number” into an actual number is a guess. That guess is wrong for zip codes with leading zeros, for phone numbers, for product SKUs, and for long numeric IDs that lose precision when parsed as IEEE 754 doubles. Preserving strings keeps your data intact; cast the fields you actually want as numbers in whatever consumes the JSON.

Empty lines are skipped rather than becoming empty objects. Quoted fields containing commas, embedded quotes, and newlines inside quotes are handled correctly by the underlying RFC 4180-style parser — this is exactly where hand-rolled “split on comma” code breaks.

How JSON to CSV Conversion Works

The input must be a JSON array of objects. That is the only structure with a well-defined tabular representation: each object is a row, each key is a column. If you pass a single object, a bare array of values, or a deeply nested document, the tool reports that the JSON must be an array of objects rather than producing a misleading half-table.

Column headers are derived from the object keys, values are quoted where necessary, and embedded commas, quotes, and newlines are escaped so the output round-trips cleanly back to JSON.

The genuine limitation here is nesting. A field whose value is itself an object or an array has no natural single-cell representation. If your JSON has structure like {"user": {"name": "...", "email": "..."}}, flatten it before converting — typically into user.name and user.email columns — or the nested values will not land in the table the way you expect. This is a property of the formats, not a defect in any particular converter: CSV is flat and JSON is not.

Working with Excel Files

Excel input is read entirely in the browser. Both the modern .xlsx format and the legacy .xls format are supported, and multi-sheet workbooks are handled — every sheet name is listed and you can switch between them without re-uploading.

Dates are formatted as yyyy-mm-dd rather than emitted as Excel’s internal serial numbers, so a cell showing 15 March 2024 becomes 2024-03-15 instead of 45366. This is one of the more frequent surprises when moving data out of Excel, and normalising to ISO order also makes the result sortable as text.

Excel output is generated as a genuine .xlsx workbook with a single sheet, not a CSV file with a spreadsheet extension. That distinction matters if the file is going to be consumed by another program rather than opened by a human.

The file size limit is 10 MB. That is a browser-memory constraint, not an arbitrary paywall — parsing happens in a single tab with your data held in RAM. For a larger CSV, split it first with the CSV splitter and convert the pieces.

Common Problems and What They Mean

  • “JSON must be an array of objects.” Your top-level value is an object or a primitive. If the records are nested under a key such as data or results, extract that array first.
  • Columns shifted by one. The CSV almost certainly contains an unescaped comma inside an unquoted field, or the file uses semicolons as separators — common in European Excel locales, where the list separator follows the decimal comma.
  • Keys with trailing spaces. Headers are trimmed here, so if you see this in output from another tool, that is why the same file behaves differently.
  • Leading zeros disappeared. If they were already gone before conversion, Excel stripped them when the file was opened. Fix it at the source by importing the column as text.
  • Row count lower than expected. Blank lines are skipped. A count that is exactly one lower than the line count usually just means the header row is not counted as data.

Related Tools

To inspect a CSV as a sortable table before converting it, use the CSV viewer. To break a large file into manageable chunks, use the CSV splitter. Once you have JSON, the JSON formatter will pretty-print, minify, and validate it. For conversions beyond these three formats — YAML, XML, and TOML among them — see the data format converter.

Frequently Asked Questions

Is my data uploaded anywhere?

No. CSV parsing, JSON serialisation, and Excel reading and writing all run as JavaScript inside your browser. No file or pasted text is sent to a server, and nothing is stored.

Why are my numbers converted to strings in the JSON?

CSV has no types, so every value arrives as text. Converting anything that looks numeric would corrupt zip codes with leading zeros, phone numbers, and IDs longer than 15 digits. Cast the specific fields you need in your own code.

Can it handle nested JSON?

Not usefully, for the JSON-to-CSV direction. CSV is a flat format with no representation for a nested object or array in a single cell. Flatten your structure into dotted column names before converting.

What is the maximum file size?

10 MB. The limit exists because the entire file is held in browser memory during parsing. Split larger files and convert them in parts.

Does it support multi-sheet Excel workbooks?

Yes. All sheet names are detected and a selector lets you convert any sheet. Each conversion produces one sheet’s worth of data.

What happens to dates in Excel files?

They are converted to yyyy-mm-dd strings rather than left as Excel serial numbers, so the output is human-readable and sorts correctly as text.

My CSV uses semicolons instead of commas. Will it work?

The parser detects the delimiter automatically in most cases, but if a semicolon-separated file parses as a single column, do a find-and-replace to commas first — being careful with any decimal commas in the data.

Does the tool need the CSV to have a header row?

Yes. The first row is treated as headers and becomes the JSON keys or the Excel column titles. A file without headers will lose its first data row into the header position, so add one before converting.

What Is CSV to JSON Conversion

CSV to JSON conversion transforms tabular data from Comma-Separated Values format into JavaScript Object Notation format, and vice versa. CSV is the universal format for spreadsheet data—simple rows and columns separated by delimiters. JSON is the standard for web APIs and modern applications—nested, typed data structures. Converting between these formats is a daily task for developers, data engineers, analysts, and anyone integrating spreadsheet data with web services.

CSV excels at flat, tabular data but cannot represent nested structures, typed values, or hierarchical relationships. JSON supports nesting, arrays, booleans, numbers, and null values but is verbose for simple tables. Understanding when and how to convert between them—and the edge cases involved—is essential for reliable data pipelines.

How CSV and JSON Differ

FeatureCSVJSON
StructureFlat rows and columnsNested objects and arrays
Data typesEverything is a stringString, number, boolean, null, object, array
HeadersFirst row (by convention)Object keys in every record
NestingNot supportedUnlimited depth
File sizeCompactLarger (key names repeated)
ReadabilityEasy in spreadsheetsEasy in code editors
StandardsRFC 4180RFC 8259

Conversion challenges:

  • Delimiter ambiguity: CSV fields containing commas must be quoted; tabs, semicolons, and pipes are also used as delimiters
  • Type inference: CSV stores everything as text; conversion must determine whether "42" is a string or number
  • Nested data: Flattening JSON objects with nested properties into CSV requires conventions like dot-notation keys (address.city)
  • Special characters: Newlines within quoted CSV fields, Unicode characters, and escape sequences require careful handling
  • Empty values: An empty CSV field could map to an empty string, null, or be omitted entirely in JSON

Common Use Cases

  • API data preparation: Convert spreadsheet data into JSON payloads for REST API imports
  • Data export: Convert JSON API responses into CSV for analysis in Excel, Google Sheets, or database import
  • ETL pipelines: Transform data between formats at ingestion and output stages of data processing
  • Database migration: Export database tables as CSV and convert to JSON for NoSQL import (MongoDB, DynamoDB)
  • Report generation: Convert JSON analytics data into CSV for business stakeholders who prefer spreadsheets

Best Practices

  1. Validate CSV structure before conversion — Check for consistent column counts, proper quoting, and encoding (UTF-8)
  2. Specify data types explicitly — Don't rely on automatic type inference; configure which columns should be numbers, booleans, or strings
  3. Handle nested JSON carefully — Use a consistent flattening convention (dot-notation or bracket notation) when converting nested JSON to CSV
  4. Preserve null vs. empty string distinction — In JSON, null and "" are different; map CSV empty fields consistently
  5. Test with edge cases — Commas in values, multiline fields, Unicode characters, and very large files all need testing

Frequently Asked Questions

What is the difference between CSV and JSON data formats?+

CSV (Comma-Separated Values) is a flat text format: rows and columns, first row often headers, simple structure. Example: name,age\nJohn,30. JSON (JavaScript Object Notation) is hierarchical: supports nested objects and arrays, types (strings, numbers, booleans, null), more flexible. Example: [{"name":"John","age":30}]. CSV best for: spreadsheet data, simple tabular exports, Excel compatibility. JSON best for: APIs, complex nested data, web applications, preserving data types. This tool converts between both formats instantly.

How do I handle CSV files with special characters and delimiters?+

Common delimiters: comma (,), semicolon (;), tab (\t), pipe (|). Specify delimiter when parsing. Handle quotes: fields with commas must be quoted "value, with comma". Escape quotes: double quotes inside quoted fields "She said ""hi""". Handle newlines: quoted fields can contain newlines. UTF-8 encoding: supports international characters. Excel CSV quirks: may use different delimiters based on locale. This tool auto-detects delimiters and handles quoted fields correctly. Always validate output for edge cases.

How do I convert nested JSON to CSV format?+

Nested JSON can't directly map to flat CSV. Solutions: (1) Flatten nested objects using dot notation: {user: {name: "John"}}user.name column. (2) JSON.stringify nested objects: keep as JSON string in CSV cell. (3) Create separate CSV files for nested arrays (normalized tables). (4) Repeat parent data for each nested item (denormalized). Example: {name:"John", orders:[1,2]} could become two rows with repeated name. Choose based on use case: analysis (flatten), re-import (stringify), database (normalize). This tool offers flattening options.

What are common errors when converting between CSV and JSON?+

Type conversion issues: CSV treats everything as strings, JSON distinguishes types. Numbers become strings: "123" instead of 123. Solution: parse numeric columns. Booleans: "true" vs true. Date handling: CSV has no date type, must parse. Empty fields: empty string vs null vs undefined. Headers: missing or malformed headers break conversion. Special characters: unescaped quotes, newlines in fields. Large files: memory limits for browser-based tools. Encoding: non-UTF-8 causes garbled text. This tool handles type inference and provides validation feedback.

How do I optimize CSV to JSON conversion for large files?+

Streaming approach: don't load entire file into memory, process line-by-line or in chunks. Node.js: use streams (csv-parser, JSONStream). Browser: use FileReader with chunking, or Web Workers for background processing. Batch processing: convert in batches of 1000-10000 rows. Memory management: clear processed data, garbage collection between batches. Server-side: handle large files (100MB+) server-side, not in browser. Compress output: gzip JSON reduces size 70-90%. Database import: consider direct CSV import to database, then export JSON from queries for very large datasets. This tool handles files up to browser memory limits (~100MB).

What JSON structure should I use for CSV data?+

Array of objects (most common): [{name:"John",age:30},{name:"Jane",age:25}]. Each CSV row → JSON object, CSV headers → object keys. Object with arrays (columnar): {names:["John","Jane"],ages:[30,25]}. Each CSV column → array. Better for data analysis. Nested structure: group related fields: [{name:"John",contact:{email:"...",phone:"..."}}]. Use for complex datasets. With metadata: {headers:["name","age"],data:[["John",30],["Jane",25]]}. Preserves structure info. Choose based on API expectations or data processing needs. Most APIs expect array of objects format.

How do I maintain data types when converting CSV to JSON?+

CSV has no type information - everything is a string. Type inference strategies: (1) Numbers: check if string is valid number, convert with parseFloat() or parseInt(). (2) Booleans: check for "true"/"false", "yes"/"no", "1"/"0". (3) Dates: detect date patterns, convert with Date.parse(). (4) Nulls: treat empty strings or "null" as null. (5) Provide type hints: specify column types in UI or via schema. (6) Keep as strings: safest for round-trip conversion. Libraries: csv-parse with cast option, Papaparse with typed columns. This tool offers automatic type detection or manual type specification per column.

What are best practices for CSV headers and JSON keys?+

CSV headers become JSON keys. Best practices: (1) Use lowercase: first_name not First Name. (2) No spaces: use underscores or camelCase. (3) No special characters: avoid @#$%. (4) Descriptive names: email not e. (5) Consistent naming: pick snake_case or camelCase and stick to it. (6) Avoid reserved words: don't use class, type if possible. (7) Unique headers: no duplicate column names. Transform headers: this tool can normalize headers automatically. Common transformations: trim whitespace, lowercase, replace spaces with underscores. Handle missing headers: generate column_1, column_2 for headerless CSV.

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.