Tutorial · 5 min read

How to Convert CSV to JSON with Nested Keys and Custom Delimiters

CSV is everywhere — database exports, spreadsheets, logs. But when you need to work with APIs or structured data, JSON is the format that counts. The challenge is mapping flat CSV columns into clean, nested JSON objects. This guide shows how to use the CSV to JSON Converter to do it in seconds, with real-time editing and no data leaving your browser.

The Problem with Flat CSV to JSON

A typical CSV export has columns like name, contact.email, contact.phone, and address.city. That dot notation is the convention for representing nested fields in a flat row:

name,contact.email,contact.phone,address.city
Alice,alice@example.com,123-456-7890,Beijing
Bob,bob@example.com,,Shanghai

The desired JSON output should group related fields under their parent objects instead of keeping dot-separated keys. A CSV to JSON converter with nested key support handles this automatically.

1. Paste and Parse — The Basic Conversion

Getting started takes 10 seconds:

  1. Open the CSV to JSON Converter.
  2. Paste your CSV data into the left panel, or upload a .csv file.
  3. The tool parses it instantly into an editable table on the right.
  4. The JSON output appears below the table, updating in real time.

The result is an array of objects with flat keys. Each CSV row becomes one JSON object:

[
  {
    "name": "Alice",
    "contact.email": "alice@example.com",
    "contact.phone": "123-456-7890",
    "address.city": "Beijing"
  }
]

This works fine for simple cases, but the dot keys aren't ideal for APIs. That's where Unflatten Keys comes in.

2. Enable Unflatten Keys for Nested JSON

Toggle the Unflatten Keys option in the configuration bar. The tool automatically detects dot-separated column headers and nests them into proper JSON objects:

[
  {
    "name": "Alice",
    "contact": {
      "email": "alice@example.com",
      "phone": "123-456-7890"
    },
    "address": {
      "city": "Beijing"
    }
  }
]

This mirrors how APIs typically return data, making it perfect for feeding into databases, REST APIs, or other tools. The preview updates instantly so you can verify the structure before downloading.

3. Handling Different Delimiters

Not all CSV files use commas. The converter supports five delimiter modes:

ModeUse Case
AutoDetects delimiter automatically — works for most files
CommaStandard CSV format
TabTSV files or clipboard data from Excel
SemicolonEuropean locale CSV (decimal comma regions)
PipeData with commas inside fields (e.g., addresses)

Select the delimiter from the config bar. The table and JSON output update immediately to reflect the change.

4. Custom Header Row Behavior

By default, the first row is treated as headers and becomes JSON keys. But CSV files vary:

Toggle the Header Row checkbox in the config bar. The JSON output changes shape instantly — try it both ways to see which format fits your use case.

5. Pretty vs Compact JSON Output

The converter offers two output formats:

Switch between them with the Output Format dropdown. The right panel preview updates instantly so you can pick the version that fits your pipeline.

Try the Free CSV to JSON Converter

Paste CSV, edit cells, see JSON update in real time. Nested keys, custom delimiters, and no server uploads.

Convert CSV to JSON Now →

Best Practices for CSV to JSON Conversion

Frequently Asked Questions

How do I convert CSV to JSON online?

Paste or upload your CSV data into the CSV to JSON Converter. The tool parses it into an editable table in real time. Configure delimiters, header rows, and nested key mapping, then click download to export as JSON.

Can I convert CSV to nested JSON with dot notation?

Yes. Enable the Unflatten Keys option in the configuration bar. If your CSV has a column named address.city, it converts to {"address": {"city": "value"}} in the JSON output. Multi-level nesting like user.address.city works too.

Which delimiters does the CSV to JSON converter support?

Auto-detect, Comma, Tab, Semicolon, and Pipe. The Auto mode detects the delimiter automatically. Use Tab for TSV files and Pipe for data with commas inside fields. The preview updates in real time when you switch modes.

Can I edit the data before converting to JSON?

Absolutely. The table preview is fully editable — double-click any cell to change values, add or delete rows. The JSON output updates instantly as you edit. No need to re-upload or re-paste your CSV.

Is my CSV data safe with this converter?

100% safe. All processing happens in your browser using client-side JavaScript. Your data never leaves your computer. The tool works offline once the page is loaded — no server uploads, no storage, no tracking.