JSON ? CSV Converter

Convert JSON arrays to CSV and CSV files back to JSON with type inference and file download.

name,age,city Alice,30,London Bob,25,New York Carol,35,Tokyo

How to Use

1

Paste JSON or CSV input

Enter a JSON array of objects to convert to CSV, or tabular CSV data to convert to JSON.

2

Configure conversion options

Set delimiter (comma, tab, semicolon), header row inclusion, and type inference preferences.

3

Review the converted output

Check the result: CSV table with proper column headers, or JSON array with typed fields.

4

Download or copy the result

Copy JSON output for API use, or download CSV directly for Excel and database import.

JSON and CSV Data Formats

JSON (JavaScript Object Notation) is a flexible, hierarchical data format used in APIs and web applications. CSV (Comma-Separated Values) is a flat table format supported by Excel and database tools. Converting between them is a common data engineering task.

Real-World Examples & Use Cases

API Data to Spreadsheet Export

Developers and analysts working with REST API responses that return JSON arrays need to analyze the data in Excel or Google Sheets. Converting the API's JSON output directly to CSV makes it immediately importable into a spreadsheet without writing custom export code. A user list from a CRM API ({id, name, email, created_at} objects) becomes a tidy spreadsheet table with one row per user, ready for filtering, sorting, and analysis without any additional transformation.

Database Import and Bulk Data Loading

Database administrators performing bulk data imports use CSV format because all major databases support CSV import: MySQL LOAD DATA INFILE, PostgreSQL COPY, SQLite .import, MongoDB mongoimport with CSV mode. When source data exists as JSON (from an API, a document store, or a backup), converting JSON to CSV first enables standard bulk import workflows. The type inference during conversion ensures numeric columns import as numbers, not strings, preventing data type errors.

Data Migration Between Systems

Migrating data between different software systems often involves format conversion. A legacy system exporting data as CSV needs conversion to JSON for import into a modern REST API. A document database (MongoDB, CouchDB) exporting collections as JSON needs conversion to CSV for import into a relational database (PostgreSQL, MySQL). A JSON-CSV converter handles this bidirectional transformation without requiring ETL scripts for straightforward flat data structures.

Report Generation and Business Intelligence

Business analysts and data scientists frequently receive data from developers as JSON (API exports, database query results) but need to work in spreadsheet tools or BI platforms that require CSV input (Tableau, Power BI, Looker). A JSON-to-CSV converter bridges the gap instantly: pasting the developer's JSON output and downloading a CSV ready for import into the BI tool. This eliminates the back-and-forth of asking developers to provide data in a different format.

How It Works

JSON to CSV Conversion Algorithm: Input: JSON array of objects [ {"name": "Alice", "age": 30, "city": "NYC"}, {"name": "Bob", "age": 25, "city": "LA"} ] Step 1: Extract headers from first object keys: headers = Object.keys(jsonArray[0]) → ["name", "age", "city"] Step 2: For each object, extract values in header order: row1 = headers.map(h → obj1[h]) → ["Alice", 30, "NYC"] row2 = headers.map(h → obj2[h]) → ["Bob", 25, "LA"] Step 3: CSV escape each value: - If value contains comma, newline, or double-quote: wrap in "..." - Escape internal double-quotes: " → "" - Numeric values: no quotes needed Step 4: Join each row with delimiter (comma), join rows with \n Output: name,age,city Alice,30,NYC Bob,25,LA CSV to JSON reversal: 1. Split on newline → rows 2. First row → headers (split on delimiter) 3. Each remaining row: zip(headers, values.split(delimiter)) 4. Type inference: try parseFloat/parseInt first, then boolean check, else keep as string Edge cases: - Values with commas: "Smith, John" → must be quoted - Nested JSON objects: cannot convert to flat CSV (flatten first) - Missing keys: undefined → empty CSV cell

Frequently Asked Questions

What happens if my JSON has nested objects?
Standard CSV is a flat, two-dimensional format — it cannot represent nested objects or arrays directly. If your JSON has nested fields like {"address": {"city": "NYC", "zip": "10001"}}, a simple converter either: stringifies the nested object (the cell contains '{"city":"NYC"}' as a string), or flattens it using dot notation (creates columns address.city and address.zip). For deeply nested JSON structures, manual preprocessing (writing a flatten function) is often necessary before CSV conversion produces useful tabular output.
How does the converter handle CSV values with commas?
Values containing commas are wrapped in double-quotes per the RFC 4180 CSV standard: Alice, Bob becomes "Alice, Bob" in CSV. If a value itself contains double-quotes, they're escaped by doubling them: She said "hello" becomes "She said ""hello""". Multiline values containing newlines are also wrapped in double-quotes. Most CSV parsers (Excel, Python's csv module, PostgreSQL COPY) handle this escaping correctly. Tab-delimited CSV (TSV) avoids the comma-quoting issue for data that commonly contains commas but rarely contains tabs.
Will JSON number values stay numbers in CSV?
In CSV, 30 and "30" are technically the same (both are the string '30'). Whether the CSV column becomes numeric when imported depends on the importing application. Excel auto-detects numbers and converts numeric-looking strings to number values. PostgreSQL COPY and MySQL LOAD DATA need the target column data type defined in the schema — they'll convert the string to number if the column is INT or FLOAT. When converting CSV back to JSON, type inference converts '30' to the number 30, 'true' to boolean true, and keeps other values as strings.
Can I convert CSV with a different delimiter (semicolons, tabs)?
Yes. European locale CSV files commonly use semicolons (;) as delimiters because comma is used as the decimal separator (1.234,56 is 1,234.56 in European number format). Tab-delimited files (TSV, .tsv or .txt) are often exported from Excel and databases. A configurable JSON-CSV converter lets you specify the delimiter. When importing TSV to JSON, select tab as the delimiter. When exporting JSON to CSV for French/German Excel, select semicolons. Most robust converters auto-detect the delimiter based on the most common separator character in the first line.
What is the maximum size of JSON or CSV I can convert?
Browser-based converters work entirely in memory. Practical limits depend on available browser memory, but most tools handle files up to ~50MB comfortably. For very large datasets (hundreds of MB or GB), use server-side tools: Python's pandas library (pd.read_json() and df.to_csv()), jq (command-line JSON processor: cat data.json | jq -r '.[0]|keys_unsorted, (map([.[]][]))|@csv'), or Node.js streaming CSV parsers. Large datasets are better processed in a pipeline where data is streamed and processed in chunks rather than loaded entirely into memory.

Related Tools

Explore other tools in this category.

Looking for something else?