Developer Tools · CSV to JSON

ToolAdda

CSV to JSON Converter

Paste, upload, drag & drop, or import CSV from a URL and get clean, valid JSON instantly — with spreadsheet preview, live validation, tree & raw views, column mapping, and batch conversion.

All conversion happens in your browser — your CSV never leaves your device.
🔒 No server storage ⚡ Instant conversion 📦 Large file support 🆓 Free forever
1 Paste CSV 2 Configure 3 Convert 4 Export JSON

Convert CSV to JSON

Paste CSV, upload a file, drag & drop, or import from a URL — output updates live for smaller files.

CSV Input

Empty Paste, upload, or import CSV to begin.

JSON Output

🕘 History (undo/redo & recent conversions)
    📦 Batch Conversion (multiple files → ZIP)
      Characters0
      Rows
      Columns
      File Size
      Output Size
      Duplicate Rows
      Delimiter: — · Conversion Time
      ⚙️ Conversion Settings
      📊 Spreadsheet Preview

      Features

      Why Developers Choose ToolAdda's CSV to JSON Converter

      🔒 100% private

      Parsing runs entirely in JavaScript in your browser. Your CSV, however sensitive, never leaves your device.

      📊 Real spreadsheet preview

      See your parsed rows and columns as an actual table before you commit to converting.

      🗂️ Column mapping

      Rename or ignore any column with live-updating output — no post-processing script required.

      🔢 Smart type detection

      Numbers, booleans, and null values are inferred automatically, while safely keeping leading-zero IDs as strings.

      🧩 Nested object mapping

      Dot-notation headers like address.city build real nested JSON objects automatically.

      🧬 JSON Schema export

      Generate and download a draft-07 JSON Schema inferred straight from your converted data.

      📦 Batch + ZIP

      Convert many CSV files at once and download every JSON result in a single ZIP archive.

      ↶ Undo/redo history

      Every conversion is checkpointed — jump back to any previous input and output instantly.

      ♿ Fully accessible

      Semantic tabs, ARIA live regions, keyboard-navigable tree, and full color-contrast compliance.

      Complete guide

      What Is CSV, What Is JSON, and How Conversion Works

      What Is CSV?

      CSV (Comma-Separated Values) is a plain-text format for tabular data: each line is a row, and values within a row are separated by a delimiter — usually a comma, though semicolons, tabs, and pipes are common in different regions and exports. The first row conventionally holds column headers, and values containing the delimiter itself, line breaks, or quote characters are wrapped in quotes so they don't get misread as separate columns. Every spreadsheet application (Excel, Google Sheets, Numbers) and virtually every database and BI tool can export to and import from CSV, which is exactly why it remains the universal lowest-common-denominator format for moving tabular data between systems.

      What Is JSON?

      JSON (JavaScript Object Notation) is a lightweight, text-based data format built from two structures — objects (key-value pairs in curly braces) and arrays (ordered lists in square brackets) — plus primitive types: strings, numbers, booleans, and null. Because it maps directly onto the object and array types every modern programming language already has, JSON is the default format for REST APIs, mobile app payloads, NoSQL databases, and frontend state management. Unlike CSV, JSON can represent nested structure natively — an object inside an object, or an array of objects — which is precisely the gap this converter bridges when it turns flat spreadsheet rows into structured data.

      CSV vs JSON: Key Differences

      CSV is flat by design: every value lives in a single row/column cell, with no native concept of nesting, arrays, or explicit types — every cell is just text until something decides otherwise. JSON is hierarchical and typed: values can be strings, numbers, booleans, null, nested objects, or arrays of any of those. Converting CSV to JSON means making explicit decisions CSV never had to: which cells should become numbers vs. strings, whether dot-notation headers should build nested objects, and whether the whole dataset should be a bare array or wrapped in a named root property.

      Advantages of JSON

      • Native nesting and arrays — no flattening tricks required to represent related data.
      • Explicit types (numbers, booleans, null) instead of everything being an untyped string.
      • Native parsing in every modern language (JSON.parse in JavaScript, json.loads in Python) with zero extra libraries.
      • The de facto standard for REST APIs, GraphQL responses, and mobile app payloads.

      Advantages of CSV

      • Universally supported by every spreadsheet application and BI tool without any coding.
      • Extremely compact for large, uniform tabular datasets — no repeated key names per row.
      • Human-editable in a plain text editor or spreadsheet without needing to understand JSON syntax.
      • The standard export/import format for databases, CRMs, and accounting software.

      How CSV to JSON Conversion Works

      This converter first parses the raw text into records using an RFC 4180-style, quote-aware algorithm — so a comma or line break inside a quoted field never gets mistaken for a delimiter. The first record (unless you disable Header Row) becomes the set of object keys; every following record becomes one JSON object, with each cell assigned to its corresponding header. Along the way, values are optionally trimmed, type-coerced, renamed, ignored, or expanded into nested objects based on your settings — the whole pipeline runs synchronously in your browser using plain JavaScript, with no server round-trip.

      CSV Structure Explained: Rows, Columns, Headers, Quoting

      A CSV row is one line of text; a column is the position of a value within that row, defined by how many delimiters precede it. The header row assigns a name to each column position, which becomes the JSON key for every value in that column across all following rows. Quoting matters more than most people expect: a field like "Smith, John" keeps its embedded comma safe inside quotes, and two consecutive quote characters inside a quoted field ("") represent one literal quote character — both handled correctly by this converter's parser.

      JSON Structure Explained: Objects, Arrays, and Primitives

      A JSON object is an unordered set of key-value pairs written in curly braces; a JSON array is an ordered list of values in square brackets; primitives are strings, numbers, booleans, and null. The default output of this converter is a JSON array of objects — one object per CSV row — which is the shape almost every REST API and database import tool expects when bulk-loading tabular data.

      Headers and Column Naming

      Column headers become JSON keys exactly as written, after trimming whitespace — so consistent, code-friendly header names (like first_name rather than First Name!) produce cleaner JSON without needing a rename step. If your source CSV has blank or duplicate header cells, this converter automatically substitutes safe placeholder names like column_3 so the conversion never silently drops a column.

      Data Types: Numbers, Booleans, and Null Detection

      CSV has no type system — every cell is text until something interprets it otherwise. With Auto-detect Types enabled, this converter inspects each trimmed value: a value made entirely of digits (optionally with a decimal point or exponent) becomes a JSON number, true/false become JSON booleans, and null/N/A/NA become JSON null. Critically, values with a leading zero followed by more digits (like 007 or a ZIP code 01001) are deliberately kept as strings, since converting them to a number would silently destroy meaningful leading zeros — a common bug in naive CSV-to-JSON scripts.

      Arrays and Nested Objects from Flat CSV

      CSV itself cannot represent nested structure, but real-world data often is nested — an address with a street, city, and zip, or a product with a price and currency. This converter's Nested Mapping setting reads dot-notation column headers like address.city and address.zip and builds a proper nested address object in the JSON output for every row, without you writing any post-processing code.

      Handling Missing Headers

      If your CSV export has no header row at all — common with some legacy database dumps — turn off First Row Is Header. The converter then treats every row as data and assigns generic, position-based keys (column_1, column_2, and so on), so you still get valid, usable JSON that you can rename afterward in the Column Mapping panel.

      API Development, REST APIs & System Integration

      Most modern REST APIs accept and return JSON, while a huge amount of real-world business data — sales exports, inventory feeds, CRM contact lists — still arrives as CSV from spreadsheets or legacy systems. Converting at the integration boundary (an ingestion script, an ETL job, or a one-off import endpoint) lets you keep the rest of your codebase working exclusively in JSON. This tool is ideal for prototyping that mapping quickly: paste a real CSV export, tune the settings until the JSON shape matches what your API expects, then replicate that logic in your actual integration layer.

      Frontend Development & Configuration

      Frontend frameworks and static site generators consume JSON far more naturally than CSV — a table of product data, FAQ content, or translation strings exported from a spreadsheet by a non-technical teammate can be converted here once and committed as a clean JSON data file for your build pipeline, instead of parsing CSV at runtime in the browser.

      Backend Development & Database Import

      Many NoSQL databases (MongoDB, Firestore, DynamoDB) and bulk-import tools expect JSON documents rather than tabular rows. Converting a CSV export from an existing system into an array of JSON objects here — with Column Mapping to rename fields to match your schema, and Nested Mapping to build sub-documents — gets you an import-ready file without writing a custom migration script for a one-time job.

      Data Migration & Spreadsheet Conversion

      Data migration between systems is one of the most common real-world reasons to convert CSV to JSON: exporting contacts from one CRM as CSV and importing them into another system's JSON-based API, or moving a spreadsheet-managed product catalog into a headless CMS. The spreadsheet preview and validation panel here let you sanity-check the shape and catch bad rows before you commit to a full migration run.

      Common CSV Errors and Validation Tips

      • Unclosed quotes — a stray, unmatched " character breaks parsing for the rest of the file; this converter reports the line where the unclosed quote starts.
      • Inconsistent column counts — a row with more or fewer cells than the header usually means a missing delimiter or an unescaped comma; the validation panel flags the exact line number.
      • Wrong delimiter assumed — a semicolon- or tab-separated export parsed as comma-separated collapses every row into one column; use auto-detect or set the delimiter explicitly.
      • Encoding mismatches — files saved with a different encoding than expected can show garbled special characters; enable Auto-detect Encoding when uploading.
      • Trailing empty rows — many spreadsheet exports add a blank line at the end; Skip Empty Rows removes these automatically.

      Duplicate Rows and Data Quality

      Exact duplicate rows — every column identical to an earlier row — often indicate an export bug, a repeated form submission, or a join that fanned out unexpectedly. This converter flags duplicate rows after conversion so you can decide whether to de-duplicate at the source, rather than silently importing repeated records downstream.

      Best Practices for CSV to JSON Conversion

      1. Always review the spreadsheet preview before converting a file you haven't seen the shape of before.
      2. Decide upfront whether IDs, phone numbers, or ZIP codes need to stay strings, and disable Auto-detect Types if any of them could be misread as numbers.
      3. Use Column Mapping to rename headers to your API's or database's expected field names instead of post-processing the JSON afterward.
      4. Check the validation panel's warnings for mismatched column counts — they usually point to a real problem in the source file, not a parser bug.
      5. For recurring imports, use Batch Conversion so every file in a run is processed with identical settings.

      Privacy & Security

      Every step here — parsing, validation, type detection, tree rendering, schema generation — runs entirely inside your browser's JavaScript engine. No CSV or JSON you work with is ever transmitted to ToolAdda's servers or any third party; the only exception is the optional Import from URL feature, which fetches directly from the URL you provide, from your own browser. This makes the tool safe to use even with sensitive exports — customer lists, financial records, internal inventory data — since nothing is uploaded anywhere at any point in the process.

      Why Choose ToolAdda's CSV to JSON Converter

      Most free CSV to JSON tools stop at a single "convert" button and a plain textarea, with no visibility into how types were guessed or which rows had problems. This one adds a real spreadsheet preview, a collapsible tree view, column rename/ignore mapping, dot-notation nested object mapping, transparent and configurable type detection, duplicate-row detection, JSON Schema generation, batch-to-ZIP conversion, and full undo/redo history — while remaining entirely private, free, and fast enough for large files.

      Expert Tips

      • When importing into a NoSQL database, use Nested Mapping with dot-notation headers to build the sub-documents your schema expects in one pass, instead of writing a transform script.
      • Use the generated JSON Schema as a starting point for TypeScript interfaces or API documentation — it's far faster than hand-writing one from scratch.
      • If a column contains values like phone numbers or account IDs that happen to look numeric, disable Auto-detect Types (or rename just that column after noticing the issue in the preview) to keep them safely as strings.
      • For recurring exports (a nightly report, a batch of vendor files), use Batch Conversion to process every file with identical settings in one pass.

      Using the Converted JSON in Your Code

      This page is a browser tool, not a hosted API — everything runs client-side, so there's no endpoint to call. If you want to replicate the same conversion in your own backend or scripts, here's the equivalent logic in a few common stacks, plus how to send the resulting JSON to a REST API.

      // Node.js — parse CSV to an array of objects using csv-parse
      const { parse } = require("csv-parse/sync");
      const fs = require("fs");
      
      const csv = fs.readFileSync("data.csv", "utf8");
      const records = parse(csv, { columns: true, skip_empty_lines: true });
      
      console.log(JSON.stringify(records, null, 2));
      # Python — convert CSV to JSON with the built-in csv module
      import csv, json
      
      with open("data.csv", newline="", encoding="utf-8") as f:
          reader = csv.DictReader(f)
          rows = list(reader)
      
      print(json.dumps(rows, indent=2))
      // Send the converted JSON to your own REST API
      const response = await fetch("https://api.example.com/import", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(convertedJson),
      });
      
      if (!response.ok) throw new Error(`Import failed: ${response.status}`);
      console.log("Imported successfully");

      FAQ

      Frequently Asked Questions

      What is a CSV to JSON converter?

      A CSV to JSON converter transforms comma-separated tabular data — rows and columns — into JSON, typically an array of objects where each row becomes one object keyed by the column headers.

      Is this CSV to JSON converter free?

      Yes. ToolAdda's CSV to JSON converter is completely free, has no usage limits, and requires no account or sign-up.

      Is my CSV data uploaded to a server?

      No. Parsing and conversion happen locally in your browser using JavaScript. Nothing you paste, upload, or import is ever sent to ToolAdda's servers — the only exception is the optional Import from URL feature, which fetches directly from the URL you provide, from your own browser.

      How does the converter detect the delimiter automatically?

      It samples the first part of your file and tests comma, semicolon, tab, and pipe delimiters, scoring each by how consistent the resulting column count is across rows, then picks the best match. You can override this in Settings if needed.

      Can I use a custom delimiter?

      Yes. Choose Custom in the Delimiter setting and enter any single character, useful for exotic exports that use characters like ~ or ^.

      What happens if my CSV doesn't have a header row?

      Turn off First Row Is Header in Settings and the converter will generate generic keys (column_1, column_2, and so on) from the column position instead of treating the first row as column names.

      Can I rename or ignore specific columns?

      Yes. Once you convert, the Column Mapping panel lists every detected column with a rename field and an Ignore checkbox — changes apply instantly to the JSON output and the preview table.

      Does the converter auto-detect numbers, booleans, and null values?

      Yes, when Auto-detect Types is enabled. Numeric-looking cells become JSON numbers, true/false become booleans, and null/N/A/NA become JSON null. Disable it to keep every value as a plain string.

      Why did my ID or zip code change into a number?

      Type detection only converts a value to a number when the whole cell is cleanly numeric and doesn't start with a leading zero (so "007" and "01001" stay strings, but "10001" becomes 10001). If you need every ID to stay a string regardless, disable Auto-detect Types.

      Can I create nested JSON objects from CSV column headers?

      Yes. Enable Nested Mapping and name your columns with dot notation, like address.city and address.zip — the converter builds a nested address object from those two flat columns automatically.

      Can I output the JSON as a root object instead of a plain array?

      Yes. Set Output Shape to Root Object and choose a key name (default "data") to wrap the array, producing {"data": [...]} instead of a bare array — useful when an API expects a named top-level property.

      Does the converter validate my CSV before converting?

      Yes. Every conversion checks for unclosed quotes, empty input, and rows with an inconsistent column count, surfacing warnings with the exact line number so you can fix the source file quickly.

      What happens with rows that have the wrong number of columns?

      They still convert — missing cells become empty strings and extra cells are dropped — but the validation panel flags the exact line number so you can spot and fix inconsistent rows in your source CSV.

      Does it detect duplicate rows?

      Yes. After conversion, any row that is an exact duplicate of an earlier row (same values in every column) is counted and flagged in the validation panel.

      Can I upload a large CSV file?

      Yes. Larger inputs defer conversion by a frame with a visible progress indicator so the page stays responsive, and the spreadsheet preview only renders the first 50 rows so the browser tab never freezes on huge files.

      Does this tool detect file encoding automatically?

      Yes. When you upload a file, the converter inspects the byte-order mark (BOM) to correctly decode UTF-8, UTF-16LE, and UTF-16BE before conversion.

      Can I import CSV directly from a URL?

      Yes. Paste a public URL into the Import from URL field. The request is made directly from your browser, so the target server must allow cross-origin (CORS) requests for the fetch to succeed.

      Can I generate a JSON Schema from my CSV?

      Yes. After converting, click Export JSON Schema to download a draft-07 JSON Schema inferred from the structure and types of your converted data.

      Can I convert multiple CSV files at once?

      Yes. Use the batch conversion panel to select multiple .csv files; each is converted with your current settings and you can download all the resulting JSON files together as a single ZIP archive.

      Does the tool have undo and redo?

      Yes. Every successful conversion is saved to a short history. Use Undo and Redo, or click any entry in the History panel, to jump back to a previous CSV input and its converted output instantly.

      How do quoted fields and embedded commas work?

      Fields wrapped in quotes can safely contain the delimiter, line breaks, and escaped quotes (two quote characters in a row represent one literal quote) — the parser follows the standard CSV quoting rules (RFC 4180) rather than naively splitting on the delimiter.

      Can I switch between pretty-printed and minified JSON?

      Yes. Toggle Minify in Settings, or use the separate Download Pretty JSON and Download Minified JSON buttons to get either format regardless of the current toggle.

      What indentation options are available?

      You can choose 2 spaces, 4 spaces, or tab characters for indentation when pretty-printing the JSON output.

      Can I copy JSON ready to paste into an API request?

      Yes. The Copy API-Ready JSON button always copies a minified, single-line version of your converted data regardless of the current pretty/minify toggle — ideal for pasting straight into a request body or a curl command.

      Can I convert JSON back to CSV?

      Yes, use ToolAdda's separate JSON to CSV Converter to reverse the process.

      Does this work on mobile devices?

      Yes. The editor, tree view, table preview, and all controls are fully responsive and touch-friendly, and every feature works the same on mobile browsers as on desktop.

      What's the difference between this and Excel's CSV import?

      Excel's "Get Data" import is built for opening CSV as a spreadsheet, not producing JSON, and it applies its own often-surprising type guessing (like turning IDs into dates). This tool is purpose-built to produce clean, predictable JSON with type detection you can see and control directly.

      Does the tool support TSV (tab-separated) files?

      Yes. Select Tab as the delimiter, or let auto-detection recognize it automatically — TSV is parsed with the exact same quote-aware engine as comma-separated CSV.

      More tools

      Ready to Convert Your CSV?

      Paste, upload, or import your CSV and get clean, structured JSON in seconds — free, private, and built for real developer workflows.

      ⚡ Convert CSV to JSON Now
      CSV → JSON