DevelopmentBeginner📖 10 min read📅 2026-02-18

Complete JSON-CSV Conversion Guide

Practical tips for converting JSON arrays to Excel-compatible CSV and CSV to JSON

#JSON#CSV#data conversion#Excel#development

Complete JSON-CSV Conversion Guide

Converting between JSON and CSV formats is a common challenge in data work. Whether you need to analyze API response data in Excel, or pass a planner's spreadsheet to your development team — knowing how to convert between these formats efficiently is an essential skill. This guide covers the characteristics of both formats and practical conversion techniques you can apply immediately.

1. JSON vs CSV: Key Differences

Understanding the differences helps you determine which format suits each situation.

JSON (JavaScript Object Notation)

JSON is a versatile data format that supports hierarchical (nested) data structures.

[
  {
    "id": 1,
    "name": "John Smith",
    "department": {
      "id": 10,
      "name": "Engineering"
    },
    "skills": ["JavaScript", "Python"],
    "active": true
  }
]

JSON characteristics:

  • Supports nested structures (objects within objects, arrays within arrays)
  • Multiple data types: strings, numbers, booleans, null, arrays, objects
  • Standard format for API communication
  • Human-readable structure

CSV (Comma-Separated Values)

CSV is a flat format representing data as rows and columns.

id,name,department,active
1,John Smith,Engineering,true
2,Jane Doe,Planning,false
3,Bob Johnson,Design,true

CSV characteristics:

  • Only represents flat 2D table structures
  • Fully compatible with Excel and Google Sheets
  • Easily parsed by any programming language
  • Standard format for database import/export

When to Use Which Format?

SituationRecommended Format
API development and communicationJSON
Excel analysis and reportsCSV
NoSQL databaseJSON
Relational DB importCSV
Complex nested dataJSON
Simple tabular dataCSV

2. JSON → CSV Conversion Guide

There are a few important rules to follow when converting JSON to CSV.

Convertible JSON Structure

Correct format: Array of Objects

[
  {"name": "John Smith", "age": 30, "city": "New York"},
  {"name": "Jane Doe", "age": 25, "city": "Los Angeles"},
  {"name": "Bob Johnson", "age": 28, "city": "Chicago"}
]

This JSON converts to:

name,age,city
John Smith,30,New York
Jane Doe,25,Los Angeles
Bob Johnson,28,Chicago

Key Considerations

1. Flattening Nested Structures

Nested JSON cannot be directly converted to CSV. Flattening is required first.

// Cannot convert: nested structure
[{"user": {"name": "John", "age": 30}, "city": "NYC"}]

// Flatten first, then convert
[{"user_name": "John", "user_age": 30, "city": "NYC"}]

2. Handling Array Fields

// skills is an array → difficult to represent in CSV
[{"name": "John", "skills": ["JS", "Python"]}]

// Solution: join as string or create separate columns
[{"name": "John", "skills": "JS,Python"}]

3. Values Containing Special Characters

Values containing commas, double quotes, or newlines are automatically quoted:

name,address
John Smith,"123 Main St, Suite 456, New York"

Step-by-Step Conversion Process

  1. Input the entire JSON array (keys from the first object become headers)
  2. Select delimiter (default: comma)
  3. Configure header inclusion
  4. Click the Convert button
  5. Copy CSV or download as file

3. CSV → JSON Conversion Guide

Convert CSV to JSON when you need to use spreadsheet data in APIs or development.

Basic Conversion Example

Input CSV:

name,age,department,salary
John Smith,30,Engineering,75000
Jane Doe,25,Planning,65000
Bob Johnson,28,Design,70000

Output JSON:

[
  {"name": "John Smith", "age": "30", "department": "Engineering", "salary": "75000"},
  {"name": "Jane Doe", "age": "25", "department": "Planning", "salary": "65000"},
  {"name": "Bob Johnson", "age": "28", "department": "Design", "salary": "70000"}
]

Type Conversion Considerations

When converting from CSV to JSON, all values are strings by default. Additional processing in your application is needed for numeric or boolean types:

// JavaScript type conversion
const data = csvData.map(row => ({
  ...row,
  age: Number(row.age),
  salary: Number(row.salary),
  active: row.active === 'true'
}))

Header Configuration

  • Use first row as header: Standard CSV format — the first row becomes the key names
  • No header: All rows treated as data, automatic keys like field_1, field_2 are assigned

이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.

4. Choosing the Right Delimiter

While the "C" in CSV stands for Comma, various delimiters can be used in practice.

Delimiter Characteristics

Comma (,) — Default

name,city,salary
John Smith,New York,75000
  • Most universal delimiter
  • Fields containing commas are automatically quoted
  • Default delimiter for English-locale Excel

Tab (\t) — TSV Format

name	city	salary
John Smith	New York	75000
  • Recommended when data contains many commas
  • Ideal for addresses, descriptions, and other comma-heavy data
  • Also known as Tab-Separated Values (TSV)

Semicolon (;)

name;city;salary
John Smith;New York;75000
  • Default delimiter in European Excel (where commas are used as decimal separators)
  • Useful when sharing files with European users

Delimiter Selection Guide

  1. No commas in data → Use comma (,)
  2. Addresses, descriptions with many commas → Use tab (\t)
  3. Sharing with European teams → Use semicolon (;)
  4. Uncertain → Use comma (,) as default (automatic quoting supported)

5. Excel Compatibility and Encoding

Proper encoding configuration is critical for correctly opening CSV files containing non-ASCII characters in Excel.

Solving Character Encoding Issues

Problem: Korean or special characters appear garbled when opening CSV directly in Excel

Cause: Excel defaults to CP949 (or system locale encoding), while this tool saves in UTF-8

Solution 1: Excel Data Import

  1. In Excel, click the Data tab
  2. Select From Text/CSV
  3. Select your downloaded CSV file
  4. Encoding: Select 65001: Unicode (UTF-8)
  5. Verify delimiter and click Load

Solution 2: Use Google Sheets

Google Sheets auto-detects UTF-8 encoding:

  1. Open Google Sheets
  2. FileImport
  3. Upload the CSV file
  4. Non-ASCII characters display correctly automatically

Solution 3: Add BOM (Advanced)

Some Excel versions automatically recognize UTF-8 when a BOM (Byte Order Mark) is present. Developers can consider adding a BOM when saving.

Number Formatting Considerations

Numeric data in CSV might be interpreted as dates or other formats by Excel:

  • 01-02 → interpreted as January 2
  • 1/2 → interpreted as January 2
  • 0001 → interpreted as 1 (leading zeros removed)

In these cases, import the column as Text format, or prefix values with a single quote ('0001).

6. Practical Use Cases

Scenario 1: Planner ↔ Developer Data Exchange

Situation: A product manager needs to share Excel-managed product data with developers

// Product list (Excel/CSV)
product_code,product_name,price,stock,category
P001,Wireless Earphones,89.99,150,Electronics
P002,Laptop Stand,35.99,80,Office Supplies
  1. Product manager: Save Excel as CSV
  2. Tool: Convert CSV → JSON
  3. Developer: Use JSON directly with APIs or database
[
  {"product_code": "P001", "product_name": "Wireless Earphones", "price": "89.99", "stock": "150", "category": "Electronics"},
  {"product_code": "P002", "product_name": "Laptop Stand", "price": "35.99", "stock": "80", "category": "Office Supplies"}
]

Scenario 2: Analyzing API Response Data in Excel

Situation: Analyzing server API user data in Excel

  1. Copy API response JSON
  2. Tool: Convert JSON → CSV
  3. Open downloaded CSV in Excel for pivot tables, charts, and analysis

All processing happens in the browser — sensitive data like customer information and revenue figures is handled securely without server transmission.

Scenario 3: Database Migration

Situation: Migrating legacy CSV data to MongoDB

# 1. Convert CSV → JSON and download the file
# 2. Import to MongoDB using mongoimport
mongoimport --db mydb --collection users --file users.json --jsonArray

Scenario 4: Test Data Preparation

Situation: QA team's Excel test cases used in automated testing

// Test case CSV
test_id,input,expected_result,priority
TC001,valid@email.com,success,high
TC002,invalid-email,failure,high
TC003,,failure,medium

Convert CSV → JSON and use directly as a data file in Postman, Jest, or other testing tools.


JSON-CSV conversion is a task that both developers and non-developers frequently encounter. Understanding the characteristics of each format and using the right tools can significantly improve your data workflow efficiency.

Try the DDTool JSON-CSV Converter — convert safely in your browser with no installation required.

Complete JSON-CSV Conversion Guide | DDTool