Skip to main content
FormatDrop
How-To Guide

How to Convert JSON to CSV

JSON is the standard format for APIs and web data; CSV is the standard format for spreadsheets and databases. Converting JSON to CSV makes your API data importable into Excel, Pandas, PostgreSQL, or any BI tool. The conversion flattens the hierarchical JSON structure into rows and columns.

FormatDrop doesn't convert JSON to CSV yet. The methods below use free tools that do. FormatDrop's own converters cover common image, audio, video and PDF formats, all in your browser.

Other ways to convert JSON to CSV

  1. 1

    Python pandas

    import pandas as pd, json; pd.json_normalize(json.load(open('input.json'))).to_csv('output.csv', index=False). json_normalize turns nested objects into dotted column names such as address.city.

  2. 2

    jq (command line)

    For an array of flat objects: jq -r '(.[0] | keys_unsorted) as $k | $k, (.[] | [.[$k[]]]) | @csv' input.json > output.csv. It takes the column names from the first object.

  3. 3

    Excel for Windows (Power Query)

    Data → Get Data → From File → From JSON, then click To Table and expand the record columns with the button in the column header. Load the result and save it as CSV.

  4. 4

    Decide what to do with lists

    Arrays inside objects, such as a list of tags, have no natural CSV form. Decide whether you want them joined into one cell or split into separate rows before you convert.

Why convert JSON to CSV?

JSON describes structure; CSV describes data. The conversion is a declaration of intent: you've finished exploring the API and are ready to analyze the data. Everything downstream from that decision speaks CSV.

Frequently asked questions

How do I convert JSON to CSV with Python?
`import json, csv; data=json.load(open('input.json')); writer=csv.DictWriter(open('out.csv','w'), fieldnames=data[0].keys()); writer.writeheader(); writer.writerows(data)`. For nested JSON, use pandas: `import pandas as pd; pd.json_normalize(data).to_csv('out.csv', index=False)`.
How do I handle nested JSON objects in CSV conversion?
Pandas json_normalize() flattens nested objects: `pd.json_normalize(data, max_level=2)`. Deeply nested JSON (more than 2–3 levels) should be reshaped in Python before conversion — decide which nested fields you need and extract them explicitly.
Can jq convert JSON to CSV?
Yes, for an array of flat objects: `jq -r '(.[0] | keys_unsorted) as $k | $k, (.[] | [.[$k[]]]) | @csv' input.json > output.csv`. It writes a header row from the first object's keys, then one quoted CSV row per object.
Browse FormatDrop's converters

No account. No upload. Works in any browser.