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 comma-separated CSV and click Convert to get a JSON array of objects. The first row is treated as headers, and quoted commas inside fields are preserved.

    Values are returned as strings, even when they look like numbers or booleans. For semicolon or tab-separated data, convert the delimiter before pasting.

    Good to know before converting CSV

    The converter expects a header row, then one row per object. It keeps the column names in order and fills missing cells with empty strings.

    Headers become keys

    A header called first_name becomes the JSON key for that column.

    Types stay as text

    The value 42 becomes "42", not a numeric JSON value.

    Quoted commas are supported

    A field such as "London, UK" stays in one JSON property.

    Clean the delimiter first

    Semicolon and tab-separated files should be normalised to commas before conversion.

    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 can contain commas inside quotes, headers may have spaces, and encoding varies. Full-featured converters also handle line breaks inside quoted fields, though this tool does not.

    This tool converts comma-separated CSV to JSON in your browser. The first row becomes the keys, and each subsequent row becomes an object. It handles quoted fields and commas embedded inside quotes. Paste your CSV and get JSON. Multi-line fields and file upload are not supported.

    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",42Not supported here: each line is always treated as a separate row. Use PapaParse or Python's csv module for multi-line fields.
    Empty fieldsname,,42Empty string between delimiters, not null
    Different delimitersname;age;cityNormalise semicolon or tab-separated data to commas before using this page
    BOM characters\uFEFF"name","age"Excel adds invisible BOM bytes, strip them before parsing

    What this means for you: If you write a CSV parser with split(','), quoted commas and doubled quotes will break your output. Use a parser library such as PapaParse for JavaScript or the csv module for Python when you need automated processing.

    Worked CSV to JSON Example

    Start with a short CSV export where the first row names the columns:

    CSV input

    name,city,notes
    Aisha,Manchester,"prefers email"
    Marcus,Toronto,"VIP, beta user"

    JSON output

    [
      {
        "name": "Aisha",
        "city": "Manchester",
        "notes": "prefers email"
      },
      {
        "name": "Marcus",
        "city": "Toronto",
        "notes": "VIP, beta user"
      }
    ]

    The quoted comma in "VIP, beta user" stays inside the notes field. Without quotes, that comma would be read as a delimiter and the row would shift into the wrong columns.

    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 repeatable imports and scheduled jobs, use the library for your language so the conversion can be tested, reviewed, and rerun with the same settings.

    Related Tools

    How to use this tool

    1

    Paste your CSV data into the input box, with the first row as column headers

    2

    Click Convert to JSON to run the conversion

    3

    Copy the JSON output to your clipboard

    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 and special characters within fields. Multi-line quoted fields (where a value contains a literal line break) are not supported by this tool; each line is always treated as a separate row.
    How are quoted values handled?
    Double-quoted values preserve commas inside them, so a field like "London, UK" stays as one value. Escaped quotes (doubled as "") are converted to a single double-quote character. Note: multi-line fields are not supported; the parser treats each line as a separate row regardless of quoting. For full RFC 4180 support including multi-line fields, use a library such as PapaParse.
    Can I use semicolons or tabs as delimiters?
    This tool expects comma-separated values. European CSVs that use semicolons because commas are decimal separators need the semicolons replaced with commas first, or a converter with a delimiter setting.
    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.