All articles
Developer June 3, 2026 8 min read

Convert JSON to Excel: Three Approaches Compared

API response in JSON, stakeholder wants Excel. Three ways to do the conversion — quick online tool, command-line scripting, or building it yourself — with concrete trade-offs.

You hit an API endpoint, get back 500 JSON records, and your stakeholder asks for "the Excel version." Three legitimate ways to solve it, each with real trade-offs.

Approach 1: A free online converter

Open SwitchPDF's JSON Converter, paste your JSON, see a live preview, click "Convert to Excel," done in 30 seconds. The tool flattens nested objects using dot notation — address.city, address.zip — so each nested field becomes its own column.

Pros: Zero setup. Handles nested objects automatically. Works from any device.

Cons: Your data goes to a server briefly. For sensitive data, use a local approach.

When to use: Quick one-off, non-sensitive data, when you don't want to write code.

Approach 2: A command-line one-liner

Python with pandas

pip install pandas openpyxl
python -c "
import pandas as pd, json
data = json.load(open('input.json'))
pd.json_normalize(data).to_excel('output.xlsx', index=False)
"

pd.json_normalize is built specifically for flattening nested JSON.

Node.js with xlsx

npm install xlsx
const xlsx = require('xlsx')
const fs = require('fs')
const data = JSON.parse(fs.readFileSync('input.json'))
const flat = data.map(row => ({
  id: row.id,
  name: row.name,
  'address.city': row.address.city,
}))
const wb = xlsx.utils.book_new()
xlsx.utils.book_append_sheet(wb, xlsx.utils.json_to_sheet(flat), 'Data')
xlsx.writeFile(wb, 'output.xlsx')

Pros: Data never leaves your machine. Repeatable. Customizable.

Cons: Requires a working Python or Node environment.

When to use: Sensitive data, repeated conversions, batch jobs.

Approach 3: Building it into your own app

If JSON-to-Excel is a recurring user need in your product, ship it as a feature. A minimal Node.js + Express endpoint takes ~30 lines using xlsx. This is what SwitchPDF's JSON Converter backend does.

Pros: Fits into your product. Users don't leave your app.

Cons: Real engineering effort.

When to use: Frequent user-facing need where in-app experience matters.

Quick decision guide

  • One-off, non-sensitive: Online tool
  • Sensitive data or batches: CLI
  • In-product feature: Build it

The common thread: flatten nested objects with dot notation. Once you know that's the trick, every JSON-to-spreadsheet problem becomes a question of where to run the flattener.

Related articles