Ttooleras
📊

JSON to CSV

Converters

Flatten nested JSON into CSV rows — ready for Excel, Google Sheets, analysis. Free, private — all processing in your browser.

Advertisement

The JSON to CSV Converter transforms JSON arrays or objects into comma-separated values format, ready for Excel, Google Sheets, or any spreadsheet application. Handles the tricky case that most converters get wrong: nested objects and arrays. If your JSON has user.address.street, the converter creates a column user_address_street (or user.address.street — your choice) so the data lives in a flat table while preserving all information. Built-in options for flattening strategies (dot notation, underscore, array index brackets), custom delimiters (comma, semicolon, tab, pipe), header configuration, and Excel-compatible output (UTF-8 BOM, CRLF line endings).

Converting JSON to CSV is essential for data analysts who receive JSON from APIs but need Excel pivot tables, for developers exporting database query results (MongoDB, PostgreSQL JSONB columns), for migrating between systems that prefer different formats, and for creating human-readable reports from structured data. This converter runs entirely in your browser — your JSON (which might include customer data, API responses with sensitive fields, or proprietary data) never uploads to any server.

JSON to CSV — key features

Flatten nested JSON

Handles objects within objects within arrays. Choose dot notation, underscores, or bracket notation for keys.

Multiple delimiters

Comma (standard), semicolon (European), tab (TSV), pipe (legacy). Match your target system.

Excel-compatible output

UTF-8 with BOM, CRLF line endings, optional separator hint line. Opens perfectly in Excel.

Custom column selection

Choose which fields to include. Exclude sensitive fields, focus on what matters.

Column ordering

Alphabetical, JSON order, or manual specification. Control how your CSV is structured.

Handles inconsistent shapes

Arrays of objects with different keys — tool takes the union and leaves empty cells for missing fields.

Preview output

See the generated CSV before downloading. Verify flattening is correct.

100% client-side

Your JSON data (possibly containing sensitive records) is converted entirely in your browser.

How to use the JSON to CSV

  1. 1

    Paste JSON input

    Drop a JSON array (most common — each object becomes a row) or a single JSON object. Arrays of primitives also work.

  2. 2

    Choose flattening strategy

    Dot notation (user.name), underscore (user_name), or bracket for arrays (tags[0]). Pick based on your downstream tool.

  3. 3

    Select delimiter

    Comma for most uses. Semicolon for European Excel. Tab for TSV. Pipe for legacy systems.

  4. 4

    Configure Excel compatibility

    Enable UTF-8 BOM and CRLF for best Excel compatibility. Skip if target is Linux or programmatic consumer.

  5. 5

    Preview and adjust

    Review the CSV output. Adjust column order, remove unwanted fields, change flattening strategy if needed.

  6. 6

    Download

    Save as .csv file ready for Excel, Google Sheets, database import, or analysis tools.

Common use cases for the JSON to CSV

Data analysis

  • Analyze API data in Excel: API returns JSON — convert to CSV for pivot tables, charts, and formulas in Excel.
  • Google Sheets import: CSV is the universal spreadsheet import format. Convert JSON to CSV for quick Sheets analysis.
  • Python pandas.read_csv(): Data scientists often prefer CSV input. Convert JSON API data to CSV for pandas workflows.
  • R data.frame loading: read.csv() is standard in R. Convert JSON for statistical analysis in R.

Export and reporting

  • MongoDB query export: MongoDB returns JSON documents — flatten and export to CSV for business reports.
  • PostgreSQL JSONB column export: Extract JSON data from Postgres tables and flatten for business users.
  • Firebase/Firestore export: NoSQL databases store JSON — convert query results for executives and analysts.
  • Airtable / Notion exports: These tools have JSON APIs. Export data as CSV for traditional spreadsheet workflows.

Data migration

  • Migrate from NoSQL to SQL: Flatten JSON documents to CSV, then import via LOAD DATA or COPY.
  • System-to-system transfers: One system emits JSON, another ingests CSV. This converter bridges them.
  • Legacy ETL pipelines: Many existing ETL tools only speak CSV. Convert modern JSON sources for compatibility.
  • Data warehouse loading: Traditional data warehouses expect CSV. Convert JSON extracts before loading.

Business workflows

  • Customer list for email campaigns: Mailchimp, SendGrid import CSV. Convert customer JSON data for bulk campaigns.
  • Financial reports from APIs: Accounting APIs (QuickBooks, Xero) return JSON. Convert to CSV for traditional reporting.
  • HR data extracts: HR systems export JSON. Convert for payroll, benefits, or audit reports.
  • E-commerce order exports: Shopify, WooCommerce provide JSON APIs. Convert orders to CSV for fulfillment or accounting.

JSON to CSV — examples

Simple array of objects

Standard API response.

Input
[
  {"id":1,"name":"Alice","email":"alice@x.com"},
  {"id":2,"name":"Bob","email":"bob@x.com"}
]
Output
id,name,email
1,Alice,alice@x.com
2,Bob,bob@x.com

Nested object flattening

Deep objects become dot-notation columns.

Input
[
  {"user":{"name":"Alice","address":{"city":"NYC"}}},
  {"user":{"name":"Bob","address":{"city":"LA"}}}
]
Output
user.name,user.address.city
Alice,NYC
Bob,LA

Array within object

Arrays become indexed columns.

Input
[
  {"name":"Alice","tags":["admin","vip"]},
  {"name":"Bob","tags":["user"]}
]
Output
name,tags.0,tags.1
Alice,admin,vip
Bob,user,

Missing fields

Objects with different keys.

Input
[
  {"name":"Alice","age":30},
  {"name":"Bob","city":"NYC"}
]
Output
name,age,city
Alice,30,
Bob,,NYC

Quoted fields with commas

Values containing commas properly escaped.

Input
[{"name":"Smith, John","note":"Says hi"}]
Output
name,note
"Smith, John",Says hi

Excel UTF-8 export

BOM and CRLF for Excel compatibility.

Input
[{"name":"São Paulo"}]
Mode: Excel UTF-8
Output
(BOM)name(CRLF)"São Paulo"(CRLF)
Opens cleanly in Excel with accents intact.

Technical details

Converting JSON to CSV requires flattening hierarchical data into a 2D table. The challenge: CSV has no native support for nesting.

Flattening strategies:

Given this JSON:
``json
{
"user": {
"name": "Alice",
"address": {
"city": "NYC",
"zip": "10001"
},
"tags": ["admin", "vip"]
}
}
``

Dot notation (most common):
``csv
user.name,user.address.city,user.address.zip,user.tags[0],user.tags[1]
Alice,NYC,10001,admin,vip
``

Underscore (SQL-friendly):
``csv
user_name,user_address_city,user_address_zip,user_tags_0,user_tags_1
Alice,NYC,10001,admin,vip
``

Bracket notation for arrays:
``csv
user.name,user.address.city,user.address.zip,user.tags
Alice,NYC,10001,"[admin,vip]"
``

Array of objects (common API response):
``json
[
{ "id": 1, "name": "Alice", "tags": ["a", "b"] },
{ "id": 2, "name": "Bob", "tags": ["c"] }
]
``

Converts to:
``csv
id,name,tags.0,tags.1
1,Alice,a,b
2,Bob,c,
``

Empty cells for missing values (row 2 has no tags.1).

CSV escaping rules (RFC 4180):

- Fields containing commas, quotes, or newlines must be enclosed in double quotes.
- Double quotes within quoted fields are escaped as two double quotes (Hello "World" becomes "Hello ""World""").
- Line endings: CRLF (Windows) is the spec; LF (Unix) is commonly accepted.

Excel compatibility:

- UTF-8 BOM — Excel requires BOM to recognize UTF-8 encoding. Without it, non-ASCII chars (accents, CJK) appear garbled.
- CRLF line endings — Excel accepts both LF and CRLF, but CRLF is safer.
- Semicolon delimiter — European Excel uses semicolons. Same data file, different regional settings.
- Separator hint — First line sep=, or sep=; tells Excel which delimiter to use.

Handling primitives vs objects:

- Top-level array of objects: each object becomes a row. Most common case.
- Top-level single object: becomes a single-row CSV (one row with the keys as columns).
- Top-level primitive or array of primitives: limited CSV representation.

Column order:

- Alphabetical (deterministic, default).
- First-seen order (original JSON key order, may vary).
- Manual ordering (specify column list).

Missing fields / inconsistent shapes:

JSON allows objects in an array to have different keys:

``json
[
{ "name": "Alice", "age": 30 },
{ "name": "Bob", "city": "NYC" }
]
``

CSV has fixed columns. The converter takes the union of all keys and leaves empty cells for missing values.

Common problems and solutions

Nested arrays create many columns

An array of 100 items creates 100 columns (tags.0 through tags.99). Rows without full arrays have empty cells. For highly variable-length arrays, consider keeping them as JSON strings in one column.

Excel opens UTF-8 CSV as garbled text

Excel on some versions does not detect UTF-8 without BOM. Enable the UTF-8 BOM option for correct display of accents and non-ASCII characters.

Deeply nested JSON becomes unwieldy

10 levels of nesting produce very long column names. Consider pre-processing JSON to extract only fields you need, or splitting into multiple CSVs (one per nested level).

Array of objects with different structures

If objects have wildly different shapes, CSV becomes sparse with many empty cells. Group similar-shaped objects before converting, or output as multiple CSVs.

Duplicate keys after flattening

{a: {b: 1}, a_b: 2} both flatten to a_b. Tool warns of collisions. Use a different separator or manually rename fields.

Date formatting

JSON stores dates as strings or numbers (Unix timestamps). CSV does not have a native date type. Excel parses date-looking strings. If you want specific date format, pre-transform before converting.

Numbers formatted as text in Excel

Excel may treat long numeric strings (credit cards, IDs) as numbers, losing leading zeros. Prefix with an apostrophe or wrap in quotes to force text.

CSV cannot represent all JSON

JSON is richer than CSV. Nested structures, mixed types, null vs empty — all lose information. For round-trip fidelity, CSV is not the right format. Use JSON if you need to preserve structure.

JSON to CSV — comparisons and alternatives

JSON to CSV vs CSV to JSON: Opposite conversions. JSON to CSV is lossy (flattens structure). CSV to JSON is reversible (preserves the 2D nature). See our CSV to JSON for the reverse direction.

JSON to CSV vs JSON to Excel (.xlsx): Excel format supports multiple sheets, formatting, formulas. CSV is plain text. For simple data export, CSV is sufficient. For rich formatting, use tools like SheetJS to produce .xlsx directly.

JSON to CSV vs JSON to SQL: SQL INSERT statements are another way to get JSON into a database. Use our JSON to SQL for direct database import. CSV is simpler; SQL is more precise.

JSON to CSV vs jq/jtbl (CLI tools): CLI tools handle huge files better and integrate into pipelines. This browser tool handles interactive conversion with visual feedback. Use CLI for automation, this tool for one-off conversion.

Flattening strategies: Dot notation is the most common and readable. Underscore is SQL-friendly (column names without dots). Bracket notation preserves array syntax. Pick based on where the CSV will be consumed.

CSV vs TSV (Tab-separated): TSV uses tabs instead of commas. Advantage: tabs rarely appear in text data, reducing escaping needs. Good for scientific data, database dumps. CSV is more universally recognized.

Frequently asked questions about the JSON to CSV

How does JSON to CSV conversion work?

The tool flattens hierarchical JSON into a 2D table. Each top-level item in a JSON array becomes a row. Nested fields (user.name.first) become columns. Arrays within objects become indexed columns (tags.0, tags.1). CSV headers are the flattened field names; CSV rows are the values.

What happens to nested objects?

Flattened using a configurable separator. {user: {name: Alice}} becomes column user.name with value Alice. Arbitrarily deep nesting supported. Choose dot notation, underscore separator, or bracket notation based on your downstream consumer preferences.

What happens to arrays?

Arrays within objects become indexed columns: {tags: [admin, vip]} becomes two columns, tags.0 = admin and tags.1 = vip. Top-level JSON arrays (most common case) become rows, with each array item a row. Mixed array types supported.

Is my JSON data safe?

Yes. Conversion happens entirely in your browser. JSON data (including customer records, API responses with sensitive fields, internal configs) never uploads anywhere. Verify with DevTools Network tab.

How do I open the CSV in Excel correctly?

Enable UTF-8 BOM option for correct display of accents and non-ASCII characters. Enable CRLF for Windows Excel compatibility. For European Excel (semicolon delimiter default), switch to semicolon. First-line separator hint (sep=,) works with some Excel versions.

What if some objects have fewer fields?

CSV is a fixed-column format. The tool takes the union of all fields across all objects. Objects missing a field get empty cells in that column. This is the standard treatment.

Can I select specific columns to include?

Yes. After generating the CSV, use the column selector to deselect fields you do not want to export. Useful for removing sensitive fields (passwords, tokens) or focusing on specific data.

What is the best flattening strategy?

Dot notation (user.name) for most cases — readable and widely supported. Underscore (user_name) if your target is SQL (dots in column names can be problematic). Bracket (user[name]) for JavaScript consumers who might parse column names.

What if my JSON has mixed-shape objects?

The tool handles this but the CSV will have many empty cells (sparse table). Consider pre-filtering JSON to group similar-shape objects, or accept the sparse CSV. Alternatively, output as multiple CSVs (one per object schema).

How large a JSON can I convert?

Multi-megabyte JSON files work fine in modern browsers. Very large files (100+ MB) may slow your browser. For huge data, use command-line tools like jq or write a dedicated script.

Additional resources

Advertisement

Related tools

All Converters

Learn more

Explore more tools

200+ free tools that run in your browser.

Browse all tools →