Skip to content
← Back to blog
JSON & DataMarch 30, 2026·4 min read

How to Convert JSON to CSV (3 Free Methods)

TL;DR

Convert JSON to CSV for free using an online tool, Python, or the command line. Step-by-step guide with tips for handling nested objects and arrays.

You pulled data from an API. Now someone needs it in a spreadsheet. That's the most common reason people convert JSON to CSV, and it comes up more often than you'd expect. JSON is great for machines. CSV is great for humans who live in Excel.

The conversion sounds simple on paper: take structured data, flatten it into rows and columns. In practice, nested objects, arrays, and inconsistent keys make things tricky fast. This guide walks through three free methods to convert JSON to CSV, from the quickest browser-based approach to scripted solutions for automation.

Why Convert JSON to CSV?

JSON stores data in nested key-value pairs. That structure works well for APIs, databases, and code. But most people who need to read, filter, or chart data don't want to stare at curly braces.

Here are the most common reasons to export JSON as CSV:

  • Reporting in Excel or Google Sheets, where CSV is the universal import format
  • Sharing data with colleagues who don't work with code
  • Importing records into tools like Mailchimp, HubSpot, or a CRM that expects CSV uploads
  • Running quick data analysis without writing a script
  • Feeding data into BI dashboards that accept flat file inputs

Try JSON to CSV Converter Free

Convert JSON data to CSV format for spreadsheets.

Open Tool

No signup required. Runs in your browser.

Method 1: Use Morphkit's Online JSON to CSV Converter

If you need a fast answer, this is it. No accounts, no installs, no code.

The JSON to CSV Converter on Morphkit runs entirely in your browser. Your data never leaves your machine.

Step-by-step:

  1. Open the JSON to CSV Converter
  2. Paste your JSON into the input field, or upload a .json file
  3. The tool automatically detects your JSON structure and maps keys to column headers
  4. Review the preview table to make sure everything looks right
  5. Click Download CSV to save the file

For quick cleanup before converting, you might want to run your JSON through the JSON Formatter first.

Method 2: Python Script (For Developers and Automation)

When you need to convert JSON to CSV repeatedly, or as part of a data pipeline, Python is the right tool.

import json
import csv

with open("data.json", "r") as f:
    data = json.load(f)

headers = data[0].keys()

with open("output.csv", "w", newline="") as f:
    writer = csv.DictWriter(f, fieldnames=headers)
    writer.writeheader()
    writer.writerows(data)

Handling inconsistent keys: Gather all unique keys first:

headers = set()
for row in data:
    headers.update(row.keys())
headers = sorted(headers)

Method 3: jq on the Command Line (For Power Users)

Convert a flat JSON array to CSV:

jq -r '(.[0] | keys_unsorted) as $keys | $keys, (.[] | [.[$keys[]]]) | @csv' data.json > output.csv

For a specific subset of fields:

jq -r '.[] | [.name, .email, .plan] | @csv' data.json > output.csv

Handling Nested JSON Objects

Real-world JSON is rarely flat. The standard approach uses dot notation to create separate columns:

name address.city address.country
Alice Amsterdam NL

In Python, the pandas library handles this with json_normalize:

import pandas as pd
import json

with open("data.json", "r") as f:
    data = json.load(f)

df = pd.json_normalize(data)
df.to_csv("output.csv", index=False)

Morphkit's JSON to CSV Converter also handles nested structures automatically.

Handling Arrays Within JSON

You have a few options:

  • Join into a single string: Turn the array into a comma-separated value in one cell.
  • Explode into separate rows: Create one row per array value.
  • Create numbered columns: Make tags.0, tags.1, tags.2 columns.

Tips for Clean CSV Output

  • Choose your delimiter carefully. If your data contains commas, consider semicolons or tabs.
  • Handle special characters. Fields with commas, quotes, or newlines should be wrapped in double quotes.
  • Watch your encoding. UTF-8 is the safe default.
  • Include headers. Always include a header row.
  • Validate before sharing. Open your CSV and check that columns line up.

Going the Other Direction: CSV to JSON

Morphkit's CSV to JSON Converter handles this just as easily. You can also convert your CSV to other formats using the CSV to Excel Converter.

Pick the Right Method

Method Best for Skill level
Morphkit online converter Quick, one-time conversions Anyone
Python script Repeated tasks, data pipelines Developers
jq command line Fast terminal conversions Power users

For most people, the JSON to CSV Converter gets the job done in under a minute. No code, no installs, no data leaving your browser.

Related Articles