Developer and Text Tools

From Spreadsheet to Mock API: Excel to JSON, JSON Schema and json-server

Turn spreadsheets into realistic API data: nested JSON from column names, JSON Schema and TypeScript types, and a db.json for a local mock REST server.

Saizul Amin
Saizul Amin2 Nov 2026 · 3 min read
From Spreadsheet to Mock API: Excel to JSON, JSON Schema and json-server

From Spreadsheet to Mock API: Excel to JSON, JSON Schema and json-server

Front-end work should not wait for the back end. If the data already lives in a spreadsheet, the Excel to JSON Mock API Generator turns it into API-shaped JSON in seconds.

Shape the JSON with headers

HeaderJSON
pricenumber
in_stockboolean
address.citynested object
tags[]array from "a; b"
items[0].skuarray of objects

Values with leading zeros, like postcodes, stay as text so they are not damaged.

One sheet, one resource

Each sheet in a workbook becomes a resource: products, orders, customers. The db.json download contains them all, ready for the open-source json-server package. Run npx json-server db.json and you get GET, POST, PUT, PATCH and DELETE endpoints for every resource.

Test queries before running anything

The mock API tab answers GET requests in the page using the same conventions:

  • /products?_sort=price&_order=desc sorts.
  • /products?_page=1&_limit=10 pages, with a total count.
  • /products?q=lamp searches all fields.
  • /products?in_stock=true filters.

Schema and types

The JSON Schema describes each field's type, which fields can be null and which are always present. Use it to validate the real API later, or to document the contract. The TypeScript output gives typed records for front-end code.

Good mock data

  • Include edge cases: empty values, long names, zero and negative numbers.
  • Use ISO dates such as 2026-10-01T09:30:00Z.
  • Never put real personal data in files that will be shared.

A worked example

A products sheet with tags[] and dimensions.width_cm columns and an orders sheet become db.json with two resources, nested dimensions objects, tag arrays, and a schema marking price as a number.

Work in small, saved steps

Every tool in this series keeps your work as a project in your own browser. Make a change, check the preview, and use undo (Ctrl+Z) or redo (Ctrl+Y) freely; nothing is lost while you experiment. Before a big change, save a named copy from the Projects menu, so you can return to it later or compare two versions side by side. Export the project file when you want to move it to another computer or keep a backup, and import it again whenever you need it.

Handling dates and IDs

Spreadsheets often store dates as numbers or in local formats. Convert them to ISO 8601 text before export so every client parses them the same way. Keep IDs as plain values without spaces, and make sure they are unique, because the mock server uses them in URLs such as /products/2. If an ID column contains numbers with leading zeros, they stay as text, so the URL and the stored value match exactly.

Versioning the mock data

Commit the db.json file next to your front-end code. When the spreadsheet changes, regenerate the file and review the diff, so everyone sees which records or fields changed.

Privacy by design

The processing happens in the page itself. Files you open are read by code running on your device, results are calculated locally, and nothing is sent to a server or stored in a cloud account. That makes the tool suitable for customer lists, financial data and other material you would not upload to an unknown website. If a component such as a file reader or a map outline is downloaded from a public CDN, only that open-source code or public data is fetched, never your own content.

Share the result clearly

When you pass the output to colleagues, say where the data came from, when it was exported, and which settings you used, so that someone else can repeat the work and get the same answer. Keep the original file unchanged and store the cleaned or calculated version separately. A short note with the assumptions, filters and date saves a lot of questions later and makes the result easier to trust.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages