JSON to CSV Converter

Transform JSON data into clean CSV files. Handles nested objects, arrays, and JSON Lines format.

8 min read

Converter Tool

1. Input JSON Data
Drop a .json or .jsonl file here, or click to browse

How It Works

This converter reads your JSON input, identifies the structure, and flattens it into a two-dimensional table that maps directly to CSV rows and columns. The process involves three main steps: parsing the JSON text into a JavaScript object, traversing the data tree to collect all unique keys (including nested paths), and then writing each record as a CSV row with proper escaping.

When you paste or upload JSON data, the parser first tries standard JSON.parse(). If that fails, it checks whether the input follows JSON Lines format, where each line is a standalone JSON object. This dual-mode approach means you can work with API responses, database exports, log files, and streaming data without any preprocessing.

The column mapping step lets you control exactly what ends up in your CSV. Every detected field appears in the mapping panel, where you can toggle visibility, rename headers, and drag columns into your preferred order. This eliminates the need for post-processing in a spreadsheet application.

JSON Structure Guide

Not all JSON looks the same. Here are the most common patterns this tool handles:

Nested Object Handling

Real-world JSON is rarely flat. API responses from services like Stripe, GitHub, and Shopify routinely nest objects three or four levels deep. This converter walks the entire object tree and creates column headers using dot-separated paths. For instance, a structure like {"{"}user: {"{"}profile: {"{"}name: "Jo"{"}"}{"}"}{"}"} produces a column called user.profile.name.

Arrays of primitive values (strings, numbers, booleans) are joined with semicolons into a single cell. This preserves the data while keeping each record on one row. If an array contains objects, those objects are flattened with indexed notation like items.0.name and items.1.name.

This approach follows the same conventions used by tools like MDN's JSON reference and popular Node.js flat-file converters, ensuring the output is predictable and easy to work with downstream.

CSV Format Options

CSV might seem simple, but the details matter when importing into different applications. The delimiter choice affects compatibility: commas work everywhere, but semicolons are the default in many European locales where commas serve as decimal separators. Tab-separated values (TSV) avoid delimiter conflicts entirely, and pipe-delimited files work well with Unix command-line tools.

The quote character wraps values that contain the delimiter, newlines, or the quote character itself. Double quotes are the RFC 4180 standard, but single quotes can be useful for specific import targets. Line endings matter too: Windows applications expect CRLF, while Unix and macOS tools prefer LF.

Toggling the header row is useful when you need to append data to an existing CSV or when your downstream process expects raw data without column names.

Common Use Cases

Developers, analysts, and project managers reach for JSON-to-CSV conversion in a wide range of scenarios:

  1. API data export — Pull data from a REST API, paste the JSON response, and get a spreadsheet-ready file in seconds.
  2. Database migration — MongoDB exports JSON by default. Convert to CSV for import into PostgreSQL, MySQL, or a data warehouse.
  3. Log analysis — Structured JSON logs (JSON Lines format) convert neatly into rows for filtering in Excel or Google Sheets.
  4. Reporting — Transform nested analytics data into flat tables that non-technical stakeholders can open in any spreadsheet app.
  5. Data cleaning — Use the column mapping to drop unwanted fields and rename headers before passing data along.

Frequently Asked Questions

How does the JSON to CSV converter handle nested objects?

Nested objects are automatically flattened using dot notation. For example, an object with address.city and address.state becomes separate CSV columns named address.city and address.state.

Can I convert JSON Lines (JSONL) format to CSV?

Yes. The converter auto-detects JSON Lines format where each line contains a separate JSON object. It parses each line independently and merges all objects into a unified CSV output.

What happens to arrays inside my JSON data?

Arrays of primitive values are joined with semicolons by default. This keeps them in a single CSV cell while preserving the data.

Is my JSON data sent to a server?

No. All processing happens entirely in your browser using client-side JavaScript. Your data never leaves your device, making this tool safe for sensitive or proprietary information.

What CSV delimiters are supported?

The converter supports comma, semicolon, tab, and pipe delimiters. You can also choose between CRLF and LF line endings, toggle header rows, and set the quote character.

Browser Compatibility

This tool works in all modern browsers including Chrome 80+, Firefox 78+, Safari 14+, and Edge 80+. It relies on standard Web APIs like FileReader, JSON.parse, Blob, and the Clipboard API. No plugins, extensions, or server-side processing required. Mobile browsers on iOS and Android are fully supported, though the drag-and-drop file upload works best on desktop.

Privacy Note

This tool processes everything locally in your browser. No data is uploaded, stored, or transmitted to any server. You can verify this by disconnecting from the internet and using the tool offline. Your JSON data stays on your device at all times.

About This Tool

This free json to csv converter helps you get things done quickly and privately in your browser. No signup required, no data collected.

Built by Michael Lip. Runs 100% client-side. No data sent to any server.

100%
Client-Side
0 B
Data Uploaded
Free
Forever