CSV to JSON Converter Online
Convert CSV tabular data into structured JSON files. Optionally unflatten dot-notation headers into nested JSON objects.
Spreadsheets are popular for editing and viewing datasets because of their simple grid layout. However, modern software systems rarely use CSV for configuration or data transfer. Web APIs, databases, and configuration formats rely heavily on JSON. Converting CSV data back into structured JSON payloads is a common workflow for developers who need to import spreadsheet data into production databases or feed payloads into mock API endpoints.
Parsing CSV with RFC 4180 Rules
Parsing a comma-separated values (CSV) file is more complex than splitting strings by commas. The standard CSV specification (RFC 4180) outlines complex cases that must be handled. For example, text fields containing commas must be wrapped in double quotes (e.g., "New York, NY"). If the cell itself contains a double quote character, that quote must be escaped by prefixing it with another double quote (e.g., "She said, ""hello"""). Our converter uses a robust character scanner that reads cells character-by-character, ensuring that quoted fields and escaped quotes are parsed with 100% correctness.
Dot-Notation and the Re-creation of Objects
When a nested JSON object is converted into a flat CSV, nested keys are represented using dot-notation, such as user.profile.name. Simply converting each row into a flat object results in keys like "user.profile.name": "Bob". While technically valid, this flat representation does not match the nested schema that APIs require. To resolve this, our tool includes an unflattening algorithm. This splits headers on periods (.) and dynamically builds a nested tree structure. This ensures that the generated JSON matches the original nested schema.
Type Coercion and Data Integrity
CSV is a text-only format where every value is technically a string. JSON, however, supports rich data types, including numbers, booleans, and null values. A naive converter will output everything as a string (e.g., "price": "19.99"). Our CSV-to-JSON engine performs type coercion. It automatically converts numeric strings like "123" or "19.99" into numbers, maps "true"/"false" strings to booleans, and treats empty cells or the word "null" as null values. This preserves data type integrity across formats.
frequently asked questions
Our CSV parser strictly implements RFC 4180 rules. If a cell contains commas, newlines, or double quotes, it must be wrapped in double quotes. Double quotes inside a cell are escaped by doubling them (e.g., "cell ""value""" is parsed as: cell "value").
If your CSV headers contain periods (like "user.name" or "user.details.email"), checking this option will reconstruct nested JSON objects (e.g. {"user": {"name": "value", "details": {"email": "value"}}}). Unchecking this option keeps the output flat.
Yes, the parser checks cell values. Values like "true" or "false" become boolean types, "null" becomes null, and numeric strings are converted to JavaScript number types. Empty cells are mapped to null.
Absolutely. This converter processes your files completely in your browser. No data is transmitted to external servers, protecting your privacy and security.
Since the processing runs entirely client-side, the limit is bound by your device memory. The tool handles datasets up to 10 MB in size smoothly without blocking your browser tab.