How-To· 5 min read

How to Convert Excel to JSON — 3 Methods

JSON is the standard data format for web APIs and JavaScript applications. If your data lives in a spreadsheet and your app needs JSON, here are three ways to convert — from Python to a free browser tool that requires no code at all.

What the Output Looks Like

The standard Excel-to-JSON conversion treats the first row as object keys and each subsequent row as a JSON object:

// Excel data:
// Name        | Region | Revenue
// Acme Corp   | North  | 45000
// Beta Ltd    | South  | 32000

// JSON output:
[
  { "Name": "Acme Corp", "Region": "North", "Revenue": 45000 },
  { "Name": "Beta Ltd",  "Region": "South", "Revenue": 32000 }
]

Numbers stay as numbers (not strings), empty cells can be omitted or set to null, and the output can be pretty-printed (for readability) or minified (for production APIs).

When Do You Need Excel to JSON?

  • Feeding a web app or API — your backend expects JSON but data entry happens in Excel
  • Static site content — product lists, FAQs, or pricing tables maintained in a spreadsheet, consumed by a Next.js or Gatsby site
  • NoSQL database import — MongoDB, Firestore, and DynamoDB accept JSON for bulk imports
  • REST API testing — convert test data from a spreadsheet to JSON for Postman or Insomnia
  • Configuration files — application settings maintained by non-developers in Excel, converted to JSON for deployment

Method 1: Python with pandas (Most Flexible)

pandas makes Excel-to-JSON conversion straightforward and highly customisable:

import pandas as pd
import json

# Read the Excel file
df = pd.read_excel('data.xlsx', sheet_name='Sheet1')

# Basic conversion — first row becomes keys
records = df.to_dict(orient='records')

# Write to JSON file
with open('output.json', 'w') as f:
    json.dump(records, f, indent=2)

print(f"Converted {len(records)} rows")

For handling empty cells as null (rather than NaN, which is not valid JSON):

import math

def clean_value(v):
    if isinstance(v, float) and math.isnan(v):
        return None
    return v

records = [
    {k: clean_value(v) for k, v in row.items()}
    for row in df.to_dict(orient='records')
]

Method 2: Node.js with the xlsx Library

If you're already working in a Node.js environment, the SheetJS (xlsx) library handles this natively:

const XLSX = require('xlsx');
const fs = require('fs');

const workbook = XLSX.readFile('data.xlsx');
const sheetName = workbook.SheetNames[0];
const worksheet = workbook.Sheets[sheetName];

// Convert to array of objects (first row = keys)
const records = XLSX.utils.sheet_to_json(worksheet, {
  defval: null  // empty cells become null
});

fs.writeFileSync(
  'output.json',
  JSON.stringify(records, null, 2)
);

console.log(`Converted ${records.length} rows`);

Install with npm install xlsx. For multi-sheet exports, iterate over workbook.SheetNames and produce one JSON array per sheet.

Method 3: Free Excel to JSON Converter (No Code Required)

For a quick one-off conversion without writing any code, the ExcelErrorFinder Excel to JSON Converter runs entirely in your browser:

  1. Go to the free converter
  2. Upload your .xlsx or .xls file
  3. Select the sheet to convert (if your workbook has multiple sheets)
  4. Choose options: first row as object keys, skip empty cells, pretty or minified output
  5. Preview the first three records to verify the structure looks right
  6. Click Copy to Clipboard or Download .json

Numbers are automatically detected and stored as numeric values, not strings. The tool runs entirely in your browser — no file is uploaded anywhere.

Common Issues

Numbers Appear as Strings

If your Excel column is formatted as Text (rather than Number), the values will appear in JSON as "45000" instead of 45000. Fix: change the column format in Excel to Number before converting, or in Python use pd.to_numeric(df['column'], errors='ignore').

Dates Appear as Large Integers

Excel stores dates as serial numbers internally. In Python, pandas automatically converts these to datetime objects — control the output format with df['Date'].dt.strftime('%Y-%m-%d'). In Node.js, use cellDates: true in the SheetJS read options to get JavaScript Date objects.

Special Characters Break the JSON

Characters like \, ", or control characters in cell values need escaping. Python's json.dump and Node's JSON.stringify handle this automatically. The free tool handles it client-side as well.

Convert Excel to JSON in seconds — free

First row as keys, pretty or minified output, copy to clipboard or download. No upload, no account.

Open Free Converter →