CSV to JSON Converter
Paste CSV data and get pretty-printed JSON — supports delimiters, header toggle, and value trimming
Input & Settings
JSON Output
Output appears here
Paste CSV above or pick a sample
Examples
CSV with headers → array of objects
name,age,city
Alice,30,New York
Bob,25,Boston
// Output:
[
{ "name": "Alice", "age": "30", "city": "New York" },
{ "name": "Bob", "age": "25", "city": "Boston" }
]With the 'First row is header' toggle on, each subsequent row maps to a JSON object whose keys come from the header row.
Headerless CSV → array of arrays
Alice,30,New York
Bob,25,Boston
// Output:
[
["Alice", "30", "New York"],
["Bob", "25", "Boston"]
]With headers disabled, every row becomes a plain array of strings, preserving the original column order.
Details
This tool uses the PapaParse library to reliably parse CSV text in your browser. When 'First row is header' is enabled, each data row becomes a JSON object keyed by the header names. When disabled, rows become plain arrays. Auto-delimiter detection picks the right separator automatically, or you can force comma, semicolon, or tab. The trim option strips leading and trailing whitespace from every value before serialisation. All processing happens locally — your data never leaves your browser.
Examples
Convert a three-column CSV with a header row
name,age,city
Alice,30,New York
Bob,25,Boston[
{
"name": "Alice",
"age": "30",
"city": "New York"
},
{
"name": "Bob",
"age": "25",
"city": "Boston"
}
]Each data row becomes an object keyed by the first row, and values remain strings because dynamic typing is disabled.
Preserve commas and escaped quotes inside quoted fields
id,name,note
1,Alice,"Hello, world"
2,Bob,"Uses ""quotes"""[
{
"id": "1",
"name": "Alice",
"note": "Hello, world"
},
{
"id": "2",
"name": "Bob",
"note": "Uses \"quotes\""
}
]A CSV-aware parser keeps the comma inside the first note and converts doubled CSV quotes into literal quote characters.
About this tool
CSV (Comma-Separated Values) is the most widely used tabular data format for spreadsheets, databases, and data exports. JSON (JavaScript Object Notation) is the dominant format for APIs and modern web applications. Converting between the two is a daily task for developers, data analysts, and backend engineers.
This tool uses PapaParse — the fastest and most reliable CSV parser for JavaScript — to handle edge cases like quoted fields containing commas, escaped characters, and mixed line endings. The result is always pretty-printed, valid JSON that you can paste directly into your code or API payload.
All processing happens locally in your browser. No data is uploaded to any server, making the tool safe for confidential datasets, internal CSVs, and personally identifiable information.
How to use
Convert a CSV with headers
Paste your CSV (or pick a sample chip), keep 'First row is header' on, then click Convert to JSON. Each data row becomes a JSON object keyed by the header values.
Parse a headerless CSV as arrays
Toggle 'First row is header' off before converting. Every row is output as a plain JSON array, useful when the CSV has no column names.
Use a custom delimiter
Open the Delimiter dropdown and choose Auto-detect, Comma, Semicolon, or Tab to match your file's separator.
Use cases
Preparing spreadsheet exports for an API
Turn a header-based CSV export into an array of objects that can be reviewed, copied, and sent as a JSON request body.
Creating seed data and test fixtures
Convert a small table maintained in a spreadsheet into readable JSON fixtures for unit tests, demos, and local database seeds.
Inspecting delimited vendor data
Auto-detect commas or select semicolons or tabs, then inspect how quoted fields and empty values map into JSON before writing an importer.
Converting headerless machine output
Disable the header option to preserve each record as an array when column names are absent or supplied by a separate schema.
Output shape by mode
| Mode | JSON output |
|---|---|
| Header on | [{"name":"Alice","age":"30"}] — array of objects keyed by header |
| Header off | [["Alice","30"]] — array of string arrays |
| Trim on | Leading/trailing whitespace removed from every value |
Common mistakes
Mistake:Splitting every line on commas.
Fix:Use a CSV parser that understands quoted fields, embedded commas, doubled quotes, and line breaks. A plain split(',') corrupts valid RFC 4180-style records.
Mistake:Ignoring a byte order mark or using the wrong text encoding.
Fix:Decode the source with its declared charset and remove a leading UTF-8 BOM when necessary before interpreting header names, otherwise the first key may contain an invisible character or text may be garbled.
Mistake:Assuming the first record is always a header.
Fix:Confirm the source contract. Turn the header option off for raw row data, or supply validated column names separately when the first row is ordinary data.
Mistake:Expecting numeric, boolean, or null JSON values automatically.
Fix:This converter intentionally preserves CSV fields as strings. Apply schema-aware coercion after conversion so values such as 00123, false, and empty fields are not silently misinterpreted.
Frequently asked questions
Related guides
JSON Lines (NDJSON): Streaming JSON for Logs, Pipelines and LLMs
What makes one-object-per-line files different from JSON arrays, when NDJSON shines, and how to work with it in any language.
From Spreadsheet Rows to SQL INSERT Statements
How to turn a CSV export into typed, quoted, and safe SQL INSERT statements — and why the naive string-concatenation approach breaks on quotes, NULLs, and dates.
CSV and Markdown Tables: Bridging Spreadsheets and Documentation
How to convert CSV rows to clean GFM tables, handle pipes and newlines inside cells, and avoid the most common escaping mistakes.
JSON Formatting and Validation: Best Practices
Why strict JSON breaks so easily, the syntax errors that cause most failures, and the formatting habits that make JSON readable in diffs and reviews — with validation, minifying, and search tips.
References & standards
Related tools
Base64 Toolbox
Professional Base64 workspace for text, files and images with Base64URL, MIME, Data URI, strict validation, image preview and ready-to-use snippets.
CSV to Chart
Paste or upload CSV data and generate bar, line, pie, or doughnut charts. Export as PNG.
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV
CSV to SQL Converter
Generate SQL INSERT statements from CSV data
cURL to Code Converter
Convert cURL commands to code snippets in multiple languages. Parse cURL and generate JavaScript, Python, PHP, and more.
Diff Checker
Compare two text blocks and highlight differences side-by-side