Skip to main content

    CSV to JSON Converter

    Convert CSV data to JSON format. First row is used as keys. Copy or download the result.

    Free to use. Runs in your browser.

    Paste CSV and click Convert to get a JSON array of objects. Auto-detects the header row and supports custom delimiters (comma, semicolon, tab).

    CSV to JSON: Bridging Spreadsheets and APIs

    CSV (Comma-Separated Values) is the universal export format, every spreadsheet app, database, and analytics tool can produce one. JSON (JavaScript Object Notation) is the universal API format, every web service and modern application speaks it. Converting between them is one of the most common data tasks in development.

    The conversion sounds simple (split on commas, wrap in brackets), but real-world CSVs are messy. Fields contain commas inside quotes, line breaks appear mid-field, headers have spaces, and encoding varies. A proper converter handles all these edge cases.

    This tool converts CSV to JSON instantly in your browser. The first row becomes the keys, and each subsequent row becomes an object. It handles quoted fields, embedded commas, and different delimiters. Paste your CSV, get clean JSON, no uploads, no servers.

    CSV Edge Cases That Break Naive Parsers

    Edge CaseCSV ExampleWhat Happens
    Commas in values"London, UK",100Quotes protect the comma from being a delimiter
    Quotes in values"He said ""hello"""Doubled quotes ("") represent a literal quote
    Newlines in values"Line 1\nLine 2",42Quoted fields can span multiple lines
    Empty fieldsname,,42Empty string between delimiters, not null
    Different delimitersname;age;cityEuropean CSVs often use semicolons (because commas are decimal separators)
    BOM characters\uFEFF"name","age"Excel adds invisible BOM bytes, strip them before parsing

    What this means for you: If you're writing your own CSV parser with split(','), you'll hit these edge cases fast. Use a proper parser library (PapaParse for JS, csv module for Python) or this tool to handle them correctly.

    When to Use Each Format

    Use CSV when...

    You need spreadsheet compatibility, simple flat data, or human-readable exports. CSVs open in Excel/Sheets directly. They're smaller than JSON for tabular data and easy to generate from SQL queries.

    Use JSON when...

    You need nested data, typed values (numbers, booleans, nulls), or API compatibility. JSON preserves data types that CSV loses, "42" vs 42, true vs "true", null vs empty string.

    CSV strengths

    Smaller file sizes for flat data. Universal import/export support. Easy to generate and read. Streamable, you can process line by line without loading the whole file.

    JSON strengths

    Nested structures (objects within objects). Data types preserved. Self-describing (keys travel with values). Native to every programming language. The standard for REST APIs.

    Programming Language CSV Parsers

    LanguageLibraryQuick Usage
    JavaScriptPapaParsePapa.parse(csv, { header: true })
    Pythoncsv / pandaspd.read_csv('file.csv')
    PHPLeague\CsvReader::createFromPath('file.csv')
    RubyCSV (stdlib)CSV.parse(data, headers: true)
    Goencoding/csvcsv.NewReader(file).ReadAll()

    For one-off conversions, this tool is faster than writing code. For automated pipelines, use the library for your language, they all handle the edge cases listed above.

    Related Tools

    How to use this tool

    1

    Paste CSV data or upload a CSV file

    2

    Preview the parsed data structure

    3

    Copy or download the converted JSON output

    Common uses

    • Converting spreadsheet exports for API consumption
    • Transforming CSV datasets into JSON for web apps
    • Preparing data for NoSQL database imports
    • Converting tabular data for JavaScript projects

    Share this tool

    Frequently Asked Questions

    What CSV format is supported?
    Standard comma-separated values with the first row treated as column headers. Values can be quoted with double quotes to include commas, newlines, and special characters within fields.
    How are quoted values handled?
    Double-quoted values preserve commas and newlines inside them. Escaped quotes ("") are converted to single quotes. This follows the RFC 4180 CSV specification that Excel and Google Sheets use.
    Can I use semicolons or tabs as delimiters?
    This tool expects comma-separated values. European CSVs that use semicolons (because commas are decimal separators) will need the semicolons replaced with commas first, or use a tool that supports custom delimiters.
    Does it handle empty fields?
    Yes. Empty fields between commas become empty strings in JSON. A row like 'Alice,,London' produces {"name": "Alice", "age": "", "city": "London"}.
    What happens to data types?
    All values become JSON strings. Numbers like '42' stay as '42' (string). If you need typed JSON (numbers as numbers, booleans as booleans), you'll need to post-process the output or use a typed converter.
    Is there a size limit?
    There's no hard limit, but very large CSVs (100MB+) may slow your browser. For massive files, consider using a command-line tool like csvjson, jq, or Python's csv module instead.
    Can I convert JSON back to CSV?
    Not with this tool, it's one-way. For JSON-to-CSV conversion, many online tools and libraries exist. In JavaScript, you can map JSON objects to rows and join values with commas.
    How do I handle CSV files from Excel?
    Excel CSVs work well but may include a BOM (Byte Order Mark) at the start, which appears as garbled characters. If your first column name looks wrong, the BOM is likely the cause, strip it before pasting.
    Does it preserve the column order?
    Yes. JSON objects maintain insertion order in modern JavaScript engines. The keys in each JSON object appear in the same order as the CSV headers.
    Is my data sent to a server?
    No. All conversion happens locally in your browser. Your CSV data never leaves your device. The parsing runs entirely in JavaScript.
    What if my CSV has inconsistent column counts?
    Rows with fewer columns than headers will have empty string values for the missing columns. Rows with extra columns will have the extra data ignored (mapped up to the number of headers).
    How do I convert CSV to JSON in JavaScript?
    Split on newlines, parse the header row, then map each data row to an object: headers.reduce((obj, h, i) => ({...obj, [h]: values[i]}), {}). For production, use PapaParse, it handles edge cases properly.

    Results are for general informational purposes only and should be checked before use. They are not professional advice. See our Disclaimer and Terms of Service.