# JSON Formatter & Validator

> Format, validate, repair and analyse JSON — with errors that point at the exact line.

To format JSON, paste it above and it is validated, pretty-printed and analysed instantly. You can then explore it as a collapsible tree, a table of records or a JSONPath query, and malformed input is repaired automatically — trailing commas, comments, single quotes, unquoted keys, Python literals and NDJSON.

**URL:** https://convertto.tech/t/json-formatter
**Category:** Data & Format Tools (https://convertto.tech/c/data-tools)
**Privacy:** Runs entirely in the browser; no upload
**Cost:** Free, no sign-up
**Last updated:** 2026-08-01

## Key facts

- **Layout:** Two full editors side by side, auto-syncing — or detach the result and edit it independently
- **Views:** Collapsible tree, formatted source, record table, structure analysis
- **Repairs:** Trailing commas, comments, single and smart quotes, unquoted keys, Python True/False/None, NaN, NDJSON
- **Query:** Live JSONPath filtering and full-text search across keys and values
- **Errors:** Reported with exact line, column and a code frame
- **Privacy:** Runs entirely in your browser — nothing is uploaded
- **Cost:** Free, unlimited, no sign-up

## How to use

1. Enter or paste your json.
2. Choose the indent.
3. Turn "Sort keys alphabetically" on or off as needed.
4. Turn "Try to repair" on or off as needed.
5. The result appears immediately — copy or download it.

## FAQ

### Why does my JSON fail with a trailing comma?

The JSON specification does not allow trailing commas, unlike JavaScript object literals. Leave "Auto-repair" on and this tool strips them for you rather than just refusing, then tells you it did.

### Can I paste a JavaScript or Python object?

Yes, with auto-repair on. Unquoted keys, single quotes, comments, True/False/None and NaN are all converted to strict JSON by a tolerant parser rather than a regular expression, so string contents are never mangled. Every change is listed above the result.

### How do I filter a large document?

Switch the query bar to JSONPath and enter an expression such as $..price or $.items[?(@.qty > 1)]. Every view — tree, formatted, table — then shows only the matches, so you can narrow a 10 MB payload to the ten fields you care about.

### Does the second editor update automatically?

Yes. Auto-sync is on by default, so the result pane re-formats as you type on the left. Turn it off with the lightning toggle and the result detaches into a document of its own that you can edit directly; it then tells you when it has fallen behind the source, and a single click pulls the source back in. The choice is remembered on your device.

### My JSON arrived as an escaped string. Can this fix it?

Yes. When the input is a JSON document that has been stringified — everything wrapped in quotes with \" escapes, as logs and database columns often store it — an "Unescape" button appears and unwraps it back to a real document.

### Is there a size limit?

Only your device. Parsing, the virtualised tree and every view run in your browser, so nothing is uploaded and no request limits apply. Documents in the tens of megabytes work; the tree renders only the rows on screen.

### What does nesting depth tell me?

How many levels deep the structure goes, and the Analysis view shows you the exact deepest path. Deeply nested payloads are harder to query and often signal a data model that would be easier to work with flattened or normalised.

## Sources

- [RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format](https://www.rfc-editor.org/rfc/rfc8259) — IETF
- [ECMA-404 — The JSON Data Interchange Syntax](https://ecma-international.org/publications-and-standards/standards/ecma-404/) — Ecma International

## Related tools

- [JSONPath Tester](https://convertto.tech/t/jsonpath-tester): Run JSONPath expressions against a document and see the matches instantly.
- [JSON Flattener](https://convertto.tech/t/json-flattener): Flatten deeply nested JSON into dot-notation keys, or expand flat keys back into nested objects.
- [JSON to TypeScript Converter](https://convertto.tech/t/json-to-typescript): Generate TypeScript interfaces, Zod schemas, Go structs, Python dataclasses or Rust structs from JSON.
- [JSON Validator](https://convertto.tech/t/json-validator): Check whether JSON is valid, with the precise position of the error and what usually causes it.
- [Query String to JSON Converter](https://convertto.tech/t/query-string-converter): Convert URL query strings to JSON and build query strings from JSON objects.
- [Data Format Converter](https://convertto.tech/t/data-format-converter): Convert between JSON, YAML, XML, CSV, TSV and TOML in any direction, locally in your browser.
- [.env to JSON Converter](https://convertto.tech/t/env-to-json): Convert .env files to JSON and back — for config migrations and CI variables.
- [CSV Column Extractor](https://convertto.tech/t/csv-column-extractor): Pull selected columns out of a CSV by name or position, and reorder them.
- [JSONL Validator](https://convertto.tech/t/jsonl-validator): Validate JSON Lines line by line, check chat-format structure, and estimate what training on the file would cost.
