CSV Delimiter Reference
| Symbol | Name | Usage |
|---|---|---|
| , | Comma | Standard CSV (RFC 4180) |
| ; | Semicolon | European locales (decimal commas) |
| \t | Tab (TSV) | Spreadsheet exports, database dumps |
| | | Pipe | Data with commas in fields |
Fields containing delimiters must be enclosed in double quotes. Quotes inside fields use doubled quotes: "".
3 JSON Output Formats
Array of Objects
RecommendedEach row becomes an object with header keys. Best for APIs and JavaScript. [{"name": "Alice", "age": 28}]
Array of Arrays
CompactEach row is a nested array. Header row becomes the first array. [["name","age"],["Alice",28]]
Keyed Object
Lookup tablesUses first column as keys. {"Alice": {"age": 28}, "Bob": {"age": 35}}
Common Conversions
Spreadsheet Data
Standard comma-separated, 4 rows, 4 columns
API Response Log
Semicolon-separated endpoint data
Config File
Tab-separated key-value pairs
What is CSV to JSON Conversion?
CSV to JSON conversion is the process of transforming data from Comma-Separated Values (CSV) format into JavaScript Object Notation (JSON). It is the most common data transformation operation when you need to import spreadsheet data, database exports, or log files into web applications, APIs, or modern data processing systems.
CSV is the simplest tabular data format: each line represents a record, and fields are separated by commas (or semicolons, tabs). CSV is supported by every spreadsheet application (Excel, Google Sheets, LibreOffice), database, and data analysis tool. However, CSV does not support nested data, data types, or complex structures.
JSON is the modern web data interchange standard. JSON supports nested objects, arrays, strings, numbers, booleans, and null values. Most programming languages and frameworks include built-in JSON parsing libraries. JSON is the default format for REST APIs, application configuration, and NoSQL data storage.
How CSV Parsing Works
Parsing CSV may seem simple at first glance, but it is considerably more complex due to quoting rules. According to the RFC 4180 standard, CSV follows these rules:
- Delimiters: Comma is the default, but many European locales use semicolons (because they use commas for decimal numbers). Tab-separated values (TSV) are common in data exports and scientific data.
- Quoted fields: If a field contains the delimiter, a newline, or a double quote, the entire field must be enclosed in double quotes:
"New York, NY" - Escaped quotes: Double quotes inside quoted fields are represented by doubling them:
"He said ""hello""" - Newlines in fields: Allowed inside quoted fields:
"Line 1\nLine 2"
This tool handles all of the above edge cases correctly. The parsing process runs entirely in your browser using pure JavaScript, so no data is ever sent to a server. Your data stays private and secure on your device.
CSV vs JSON — Complete Comparison
The two formats serve different purposes, and understanding their strengths helps you choose the right tool for each job:
- Data structure: CSV supports only flat (two-dimensional table) data. JSON supports nested objects, arrays within arrays, and complex tree structures of arbitrary depth.
- Data types: CSV treats everything as plain text strings. JSON distinguishes between strings, numbers, booleans, null, arrays, and objects with strong type semantics.
- File size: CSV is typically 30-50% smaller than equivalent JSON because it does not repeat key names on every row. For large datasets, this difference is significant.
- Readability: CSV is easy to read in spreadsheet applications with column alignment. JSON is easier for developers to read with its explicit key-value syntax.
- Compatibility: CSV is supported by every spreadsheet and database tool. JSON is the standard for web APIs and modern applications.
- Streaming: CSV can be read line by line (streaming). JSON requires reading the entire file for parsing (except JSON Lines/NDJSON format).
See related tools: CSV to XML Converter, JSON to YAML Converter, JSON Validator.
Handling Edge Cases (Quotes, Newlines, Encoding)
When converting CSV to JSON in real-world scenarios, you will encounter many edge cases that require careful handling:
- Quotes inside data: The field
"He said ""hello"""must become the JSON string"He said \"hello\"". This tool automatically handles this conversion according to RFC 4180 rules. - Newlines inside fields: CSV allows newline characters inside quoted fields. The parser correctly identifies field boundaries even when newline characters appear within the data.
- Character encoding: UTF-8 is the modern standard. If your CSV comes from older Excel exports (Windows-1252 or ISO-8859-1), some special characters may display incorrectly. Convert to UTF-8 before processing.
- Empty fields: Empty fields in CSV become empty strings
""in JSON, notnull. If you need to distinguish between empty and null, post-process the JSON output. - Duplicate headers: If your CSV has two columns with the same name, the later column overwrites the earlier one in the JSON object. Ensure headers are unique before converting.
Using CSV to JSON in Your Code
Here are common code examples for converting CSV to JSON in popular programming languages:
JavaScript / Node.js
const csv = "name,age\nAlice,28\nBob,35";
const lines = csv.split("\n");
const headers = lines[0].split(",");
const result = lines.slice(1).map(line => {
const values = line.split(",");
return Object.fromEntries(
headers.map((h, i) => [h, values[i]])
);
});
// [{name: "Alice", age: "28"}, ...]Python
import csv, json, io
csv_data = "name,age\nAlice,28\nBob,35"
reader = csv.DictReader(io.StringIO(csv_data))
result = json.dumps(list(reader), indent=2)
print(result)Command line (Miller / csvkit)
# Using Miller (mlr) — fast and streaming
mlr --icsv --ojson cat data.csv > data.json
# Using csvjson from csvkit
csvjson data.csv > data.json
# Using jq with @csv
jq -Rs 'split("\n") | .[1:][] | split(",")' data.csvFor large files (over 100MB), use a streaming library like PapaParse (JavaScript) or Python's built-in csv module instead of reading the entire file into memory. Streaming parsers process data row by row, keeping memory usage constant regardless of file size.
Frequently Asked Questions
You Might Also Like
CSV to XML Converter — Transform Spreadsheet Data to XML Online
Convert CSV to well-formed XML with configurable root and row element names, delimiter support, and proper escaping. Free browser-based tool — no upload needed.
JSON to YAML Converter — Convert Config Files Online Free
Convert JSON to YAML and YAML to JSON instantly. Bidirectional converter with indent control, key sorting, and sample configs. Free, private, browser-based.
JSON Formatter — Beautify, Minify & Validate JSON Online
Format, beautify, and minify JSON data with real-time validation. Configurable indentation (2/4/tab), instant error detection, copy and download. Free online JSON formatter for developers.
JSON Validator & Formatter — Check & Fix JSON Syntax Online
Validate JSON syntax instantly and see the exact error with line and column numbers. Format (pretty-print) or minify valid JSON. Free, private, runs entirely in your browser.
More in Data Converters
CSV to XML Converter — Transform Spreadsheet Data to XML Online
Convert CSV to well-formed XML with configurable root and row element names, delimiter support, and proper escaping. Free browser-based tool — no upload needed.
JSON to XML Converter — Convert JSON Data to XML Online
Convert JSON objects and arrays to well-formed XML instantly. Bidirectional: also convert XML back to JSON. Handles nested objects, arrays, special characters, and custom root elements. Free, private, browser-based.
JSON to YAML Converter — Convert Config Files Online Free
Convert JSON to YAML and YAML to JSON instantly. Bidirectional converter with indent control, key sorting, and sample configs. Free, private, browser-based.
XML Formatter & Validator — Prettify, Minify & Validate XML Online
Format and validate XML online with syntax highlighting, configurable indentation (2/3/4 spaces), and real-time error detection. Switch between prettify and minify modes. Uses the browser's native DOMParser — free, private, no data leaves your device.
JSON Validator & Formatter — Check & Fix JSON Syntax Online
Validate JSON syntax instantly and see the exact error with line and column numbers. Format (pretty-print) or minify valid JSON. Free, private, runs entirely in your browser.
JSON Minifier — Compress JSON & Remove Whitespace Online
Minify JSON online by removing all whitespace and indentation. Shows before/after size comparison with savings percentage. Validates JSON before compressing to guarantee valid output. Includes prettify mode, download, and copy. Free, private, runs entirely in your browser.
JSON Diff and Compare — Find JSON Differences
Compare two JSON objects side-by-side and highlight structural differences. Added lines in green, removed in red. Normalizes key order for accuracy.
About Data Converters
Developer tools automate the repetitive parts of software work: formatting JSON, encoding/decoding Base64, decoding JWTs to verify token claims, generating UUIDs, formatting XML, diffing configurations. These aren't glamorous tasks, but they're the friction points that eat 10-15 minutes multiple times a day — adding up to hours weekly. Running them in a clean browser tab beats wrestling with CLI dependencies or IDE extensions that might ship your private data to a third party.
Why it matters
Fast, client-side developer tools fundamentally matter because they're used with sensitive data. JWT tokens contain user identity. Base64 payloads might encode API keys. JSON dumps include customer records. If a 'developer tool' sends your input to a server to process, you've just leaked production secrets. ZestLab's dev tools run 100% client-side with no network calls after page load — what you paste stays in your browser.
Privacy and safety
All developer tools here execute in-browser using pure JavaScript. There's no 'decode server' or 'format API' — your JWT, your JSON, your encoded payload is parsed by code running on your laptop. Verify this yourself with browser DevTools → Network tab: you'll see zero outbound requests when using any tool. That's a standard we hold because dev tools handle secrets.
Best practices
- Never paste production JWT or API tokens into ANY online tool without verifying it runs client-side (check the Network tab)
- Use browser private/incognito mode for one-off decoding of sensitive payloads
- Bookmark tools you use daily — ZestLab tool URLs are stable and don't require accounts
- When formatting JSON with secrets for team review, redact credentials before sharing the formatted output