# Format and validate JSON

Paste JSON and get it back indented and syntax-highlighted. If it is invalid, you get the parser's exact complaint and where it happened, which is the part you actually needed.

*Last updated: 2026-07-14 · Source: <https://pastesheet.com/tools/json-formatter>*

## Using this without the browser

This page hosts an interactive tool: at <https://pastesheet.com/tools/json-formatter> you paste a Google Sheet URL and it returns the result in the page. There is nothing to install and no account required.

If you are an agent or a script and need this programmatically instead, connect the sheet once as a PasteSheet endpoint and read it over HTTP — the endpoint returns the same rows as JSON, stays in sync with the sheet, and needs no Google credentials:

```bash
curl 'https://pastesheet.com/api/your-endpoint-id?limit=10'
```

The same endpoint is also a read-only MCP server at `https://pastesheet.com/mcp/sheets/your-endpoint-id`, exposing `list_tabs`, `get_schema` and `query_rows`. See <https://pastesheet.com/guides/google-sheets-mcp.md>.

## It tells you where it broke

Most of the time you are not here to make JSON pretty — you are here because something rejected it and you want to know why. So when the input does not parse, this reports the specific error (`Syntax error`, `Control character error`, `Malformed UTF-8`) rather than a generic "invalid JSON", and it does not silently repair anything.

Valid input is re-emitted with two-space indentation, slashes left unescaped and Unicode left as-is, so a URL stays readable and an accented name stays an accented name instead of becoming `é`.

## The usual culprits

If it will not parse, it is almost always one of these — none of which are legal [JSON](https://www.rfc-editor.org/rfc/rfc8259), however normal they look in JavaScript:

- A **trailing comma** after the last element of an object or array.
- **Single quotes** around strings or keys. JSON requires double quotes.
- **Unquoted keys** — legal in a JavaScript object literal, not in JSON.
- **Comments.** JSON has none, whatever your editor lets you type.
- `NaN`, `Infinity` or `undefined` — all JavaScript values with no JSON representation.

## If the JSON is coming from a spreadsheet

A [PasteSheet endpoint](https://pastesheet.com) serves a Google Sheet as JSON that is valid by construction — you never hand-edit it, so it never develops a trailing comma. [Convert a sheet to JSON](https://pastesheet.com/tools/google-sheets-to-json) to see the shape it produces.

## Frequently asked questions

### Why is my JSON invalid when it looks fine?

Usually a trailing comma, single quotes instead of double quotes, an unquoted key, or a comment. All four are perfectly normal JavaScript and none of them are legal JSON, which is exactly why they are so easy to miss when you are reading the file.

### Does it change my data?

No. It re-indents valid JSON and returns it. Nothing is reordered, no keys are renamed, no values are coerced, and nothing is auto-repaired — if the input will not parse, you get the error rather than a guess at what you meant.

### Is my JSON stored or logged?

No. It is parsed, formatted and returned. Nothing is written to a database, logged or shared. As with any online formatter, if the payload contains secrets or personal data, do not paste it in the first place.

## Sources

- [RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format](https://www.rfc-editor.org/rfc/rfc8259) — IETF

## Related tools

- [Free CSV to JSON Converter Online](https://pastesheet.com/tools/csv-to-json) — Paste CSV and get formatted JSON back — one object per row, keyed by the header row. Quoted fields, embedded commas and newlines all handled. Free, no signup.
- [Free JSON to CSV Converter Online](https://pastesheet.com/tools/json-to-csv) — Paste a JSON array of objects and get CSV back, header row built from the keys. Values holding commas or quotes are escaped properly. Free, no signup.
- [Free Google Sheets to JSON Converter](https://pastesheet.com/tools/google-sheets-to-json) — Paste a public Google Sheet URL and get clean, formatted JSON instantly. No signup, no API key, and no Google Cloud project. Copy it, download it, or go live.

---

[PasteSheet](https://pastesheet.com) turns any Google Sheet into a live REST API and MCP server for AI agents — no backend, no code. Canonical HTML version of this page: <https://pastesheet.com/tools/json-formatter>
