What Is CSV to JSON Conversion?
CSV is the universal export format for spreadsheets and databases, but almost nothing downstream actually wants CSV, it wants JSON. This csv to json converter online turns a spreadsheet export into structured data instantly: paste CSV to convert csv to json online, or paste a JSON array to convert it back to CSV, entirely in your browser. As a json to csv converter in the other direction, it builds a proper CSV header row from your JSON object keys rather than guessing at structure.
How CSV Parsing Works (RFC 4180)
CSV has no single official standard the way JSON does, but RFC 4180 (2005) is the closest thing to one, and it is what this tool follows: fields containing the delimiter, a double quote, or a line break must be wrapped in double quotes, and a literal double quote inside a quoted field is represented by doubling it (""). Not every "CSV" file actually uses a comma either, so this tool auto-detects the delimiter (comma, semicolon, tab, or pipe) by counting how often each candidate character appears in the header row, which correctly handles semicolon-delimited exports common in locales where the comma is a decimal separator.
CSV to JSON: Array of Objects vs. Array of Arrays
This tool's csv to json array of objects output uses the first row as property names and builds one object per remaining row, {"name": "Alice", "age": "34"} rather than ["Alice", "34"]. That is what almost every real API and application actually wants, since it is self-describing and does not depend on column order to interpret correctly.
| Array of objects | Array of arrays | |
|---|---|---|
| Example | [{"name":"Alice"}] | [["Alice"]] |
| Self-describing | Yes, keys included per row | No, depends on a separate header row |
| What most APIs expect | Yes, this tool's default output | Rarely |
Type Inference: Why Numbers Sometimes Stay Strings
CSV is fundamentally text; there is no native concept of a number, boolean, or null in the format itself, everything is just characters. The csv to json numbers as strings problem developers run into is actually correct, deliberate behavior: this tool keeps every converted value as a JSON string rather than guessing that "34" should become the number 34, because guessing is lossy and wrong often enough to be dangerous. A ZIP code, a phone number, or a leading-zero product code would silently become a different value if parsed as a number. Convert the specific fields you need to the right type explicitly in your own code once you know what each column actually represents.
Quoted Fields, Manual JavaScript, and What This Tool Doesn't Do
Csv commas inside quotes breaking json output is one of the most common CSV parsing bugs, and it happens when a parser naively splits every line on the delimiter character instead of respecting quotes. A field like "Smith, John" (containing the delimiter) must stay as one value, not two, and this tool's RFC 4180-compliant parser handles that correctly in both directions: CSV to JSON reconstructs the original text, and JSON to CSV re-quotes any value containing the delimiter, a quote, or a newline so the output stays valid. For anyone asking how to convert csv to json in javascript directly rather than using a browser tool, the core logic mirrors what this tool does: split the input into rows respecting quoted fields (never a naive line.split(",")), use the first row as keys, and build one object per remaining row with Object.fromEntries or a manual reduce. This tool converts flat, tabular CSV to a flat array of objects only, it does not build nested JSON objects from dot-notation or bracketed column headers, every column becomes a flat top-level key, and JSON to CSV builds its header row from the first object's keys specifically, so extra keys on later objects will not appear as columns. Nothing typed here is uploaded; conversion happens entirely in your browser tab.