jsonsql.dev 100% client-side

JSON ↔ CSV Converter

Convert between JSON arrays and CSV/TSV — with nested object flattening

JSON Input
Drop a .json file here or
CSV Output

How to convert JSON to CSV online

jsonsql.dev converts JSON arrays to CSV instantly in your browser. No data is sent to any server — your JSON stays on your machine.

Paste your JSON array — copy a JSON array of objects from your API response, database export, or code and paste it into the input editor on the left. You can also drag and drop a .json file.

Choose your options — select a delimiter (comma, tab, semicolon, or pipe), toggle header row, quote all values, or flatten nested objects with dot notation.

Copy or download — click Copy to copy the CSV to your clipboard, or Download to save it as a .csv or .tsv file.

How to convert CSV to JSON online

jsonsql.dev converts CSV to JSON instantly in your browser. No data is sent to any server — your data stays on your machine.

Paste your CSV — copy CSV from a spreadsheet, database export, or text file and paste it into the input editor on the left. The delimiter is auto-detected (comma, tab, semicolon, or pipe).

Configure options — toggle "First row as headers" to use the first row as JSON keys. Enable "Parse numbers" and "Parse booleans" to auto-convert values. Choose between array of objects or array of arrays output.

Copy or download the result — click Copy to copy the JSON to your clipboard, or Download to save it as a .json file.

How nested JSON is flattened to CSV

Nested JSON objects are flattened to CSV columns using dot notation — for example, {"address": {"city": "NYC"}} becomes a column named address.city. This approach preserves the hierarchy in a flat, spreadsheet-friendly format.

When you enable the Flatten nested option, each nested key path becomes its own column header. Arrays within values are joined with semicolons.

Input (nested JSON):

[
  {
    "id": 1,
    "name": "Acme Corp",
    "address": {
      "street": "123 Main St",
      "city": "New York",
      "state": "NY"
    },
    "contact": {
      "email": "info@acme.com",
      "phone": {
        "office": "555-0100",
        "mobile": "555-0101"
      }
    }
  },
  {
    "id": 2,
    "name": "Globex Inc",
    "address": {
      "street": "456 Oak Ave",
      "city": "Chicago",
      "state": "IL"
    },
    "contact": {
      "email": "hello@globex.com",
      "phone": {
        "office": "555-0200",
        "mobile": "555-0201"
      }
    }
  }
]

Output (flattened CSV):

id,name,address.street,address.city,address.state,contact.email,contact.phone.office,contact.phone.mobile
1,Acme Corp,123 Main St,New York,NY,info@acme.com,555-0100,555-0101
2,Globex Inc,456 Oak Ave,Chicago,IL,hello@globex.com,555-0200,555-0201

CSV parsing rules (RFC 4180)

RFC 4180 defines the CSV format: fields containing commas, newlines, or double quotes must be enclosed in double quotes, and literal double quotes are escaped by doubling them. This standard ensures interoperability between different tools and platforms.

  • Field separator: Fields are separated by a delimiter character. The default is a comma (,), but other delimiters like tab, semicolon, or pipe are common in practice.
  • Quoted fields: Any field that contains the delimiter character, a newline, or a double quote must be enclosed in double quotes. For example: "San Francisco, CA" is a single field.
  • Escaping double quotes: A double quote inside a quoted field is escaped by writing two double quotes. For example: "She said ""hello""" represents the value She said "hello".
  • Trailing newline: A trailing newline at the end of the file is optional. Most parsers handle both cases correctly.
  • Line endings: Both \r\n (Windows) and \n (Unix) line endings are accepted. Our converter handles both automatically.

JSON to CSV type mapping

When converting JSON values to CSV, each JSON type is mapped to a CSV string representation:

JSON Type CSV Representation Example
String As-is (quoted if contains delimiter) "hello"hello
Number Numeric string 4242
Boolean true / false truetrue
Null Empty string null → (empty)
Array Semicolon-joined values ["a","b"]a;b
Object (flat) Dot-notation columns {"a":{"b":1}} → column a.b
Object (no flatten) JSON stringified {"a":1}{"a":1}

Code examples

Python

import csv, json, io

# JSON to CSV
data = json.loads(json_string)
output = io.StringIO()
writer = csv.DictWriter(output, fieldnames=data[0].keys())
writer.writeheader()
writer.writerows(data)
csv_string = output.getvalue()

# CSV to JSON
reader = csv.DictReader(io.StringIO(csv_string))
json_data = [row for row in reader]
json_string = json.dumps(json_data, indent=2)

Node.js

// JSON to CSV (using json2csv)
import { Parser } from 'json2csv';
const parser = new Parser({ flatten: true });
const csv = parser.parse(jsonArray);

// CSV to JSON (using Papa Parse)
import Papa from 'papaparse';
const result = Papa.parse(csvString, {
  header: true,
  dynamicTyping: true,
  skipEmptyLines: true
});
const json = result.data;

CLI (jq + csvkit)

# JSON to CSV
cat data.json | jq -r '(.[0] | keys_unsorted) as $keys | $keys, (.[] | [.[$keys[]]] ) | @csv' > out.csv

# CSV to JSON
csvjson data.csv > out.json

JSON ↔ CSV vs other tools

Feature jsonsql.dev csvjson.com jq + csvkit (CLI) pandas (Python)
Browser-based Yes Yes No (CLI) No (Python)
Client-side only Yes No (server) Yes (local) Yes (local)
Bidirectional Yes (one page) Separate pages Separate tools Yes
Flatten nested objects Yes (dot notation) Limited Manual json_normalize
Auto-detect delimiter Yes Limited Yes (csvkit) Yes (sniffer)
Parse numbers/booleans Yes (toggle) Limited Manual Yes
Handle quoted fields (RFC 4180) Yes Yes Yes Yes
Drag & drop files Yes Yes N/A N/A
Dark mode Yes No N/A N/A
No install needed Yes Yes No No

Related tools

Frequently asked questions

How are nested JSON objects handled in CSV?

When "Flatten nested" is enabled, nested objects are flattened using dot notation. For example, {"address": {"city": "NYC"}} becomes a column named "address.city". Without flattening, nested objects are JSON-stringified.

What delimiters are supported?

For JSON → CSV output: comma, tab (TSV), semicolon, and pipe. For CSV → JSON input: the delimiter is auto-detected from comma, tab, semicolon, and pipe characters.

What is RFC 4180 and how does this tool comply?

RFC 4180 is the standard that defines the CSV format. It specifies that fields containing commas, newlines, or double quotes must be enclosed in double quotes, and literal double quotes are escaped by doubling them (""). Our parser fully complies with this standard.

How are arrays inside JSON objects handled?

Array values are joined with semicolons by default. For example, ["JavaScript", "Python"] becomes "JavaScript;Python" in the CSV output.

What is the difference between CSV and TSV?

CSV uses commas as field separators, while TSV uses tab characters. TSV is often preferred when field values contain commas, since tabs rarely appear in data. Both formats are supported by this converter.

Can I parse numbers and booleans automatically from CSV?

Yes. In CSV → JSON mode, enable "Parse numbers" to convert numeric strings to JSON numbers, and "Parse booleans" to convert true/false strings to JSON boolean values.

How do I convert nested JSON with 3+ levels to a flat CSV?

Enable the "Flatten nested" option. The tool recursively flattens all nesting levels using dot notation — for example, {"user": {"address": {"city": "NYC"}}} becomes a column named "user.address.city". Arrays within nested objects are joined with semicolons.

Can I convert CSV with special characters like commas and newlines inside fields?

Yes. The parser is fully RFC 4180-compliant, meaning fields enclosed in double quotes can contain commas, newlines, and even double quotes (escaped as ""). For example, the CSV value "New York, NY" is correctly parsed as a single field rather than being split.

What happens when JSON objects in the array have different keys?

The CSV output includes a column for every unique key found across all objects. Objects missing a key get an empty cell for that column. For example, if object 1 has {name, email} and object 2 has {name, phone}, the CSV has three columns: name, email, and phone.

How do I handle UTF-8 characters like Chinese or Arabic text in CSV?

The tool processes all UTF-8 characters correctly because it runs in the browser's native Unicode environment. When you download the CSV file, it is encoded as UTF-8. To open it properly in Excel, use File → Import and select UTF-8 encoding, or save the file with a .csv extension and a UTF-8 BOM.