IT Market
Tools/Code/Documents/JSON Formatter and Validator Online — Free
JSON FORMATTER

Форматируйте и валидируйте JSON

Tool guide

JSON Formatter and Validator Online — Free

API responses, webhook bodies and config strings pulled out of an environment variable usually arrive as one unbroken line, and a missing comma or a stray closing brace is invisible in that shape. This page parses what you paste with the browser's own JSON parser, prints it indented level by level, and on failure reports the character position where parsing stopped. The payload never leaves the tab, so a response carrying customer data is safe to inspect here. See also: rewrite the checked JSON as a YAML config, view the array as a readable table, the same pretty printing for an XML file.

How to use it

  1. Paste the API response or config file contents into the «JSON Input» box, including the outermost braces.
  2. Press «Format»: the «Formatted Output» box fills with the indented document, nested objects shifted by level.
  3. If an error message appears instead of a tree, read the character position it names and check that spot in your source string.
  4. Press «Minify» to strip every line break and gap between nodes and get a compact single-line string.
  5. Take the result with «Copy» and drop it into a ticket, a test fixture or a POST body.
  6. To handle the next fragment, just replace the contents of «JSON Input» — nothing from the previous run is stored.

FAQ

How do I find where my JSON is broken when an API response will not parse?

Paste the string and press Format. Parsing halts at the first violation and names the character position, so you can count to it in the source. Three causes account for most failures: a comma before a closing bracket, single quotes instead of double ones, and a response truncated during copy. Fix one, format again, and the next problem shows up immediately.

Why does JSON with comments or single quotes get rejected?

Because that is not JSON. The format allows no comments, no trailing commas and no single quotes around keys or strings. Those are JSON5 and JSONC extensions that editors like VS Code accept but a standard parser does not. If the text came out of a tsconfig or an ESLint config, strip the comments before pasting.

How large a document can this page handle?

A few hundred kilobytes parse and print almost instantly. A multi-megabyte database dump is a bad idea: the raw string, the parsed object and the formatted output all sit in tab memory at once and the browser stalls. For that size use a command line tool and bring a single record or one branch of the document here.

Why minify JSON again after formatting it?

Indentation and line breaks are extra bytes in every request and every log line. A compact string is shorter and easier to handle in a POST body, in an environment variable or in a config field. Machines do not need readability, so the usual cycle is expand to understand, collapse to send.

Are key order and number precision preserved?

Key order inside an object survives exactly as it appeared in the source. Numbers have a catch: very long integers such as Telegram ids or snowflake keys lose precision on parse, because JavaScript stores every number as a double. If those values matter, carry them as strings instead.

Does this work on a phone?

Yes — both boxes are plain text areas that behave normally in a mobile browser and the buttons are tap sized. The catch is scrolling: long lines are painful on a small screen, and pasting a big response out of a messenger sometimes gets clipped by the system clipboard. A desktop is more comfortable for a large payload.

Where does the pasted payload end up?

Nowhere beyond the tab. Parsing and printing are done by the page's own script, and it issues no network request carrying the field contents. A response holding customer addresses or order numbers can be made readable without handing it to a third-party service. The boxes are empty after a reload, so copy the result out right away.

Examples

Webhook body arriving on one line
Before: {"order":{"id":10428,"sum":4290,"items":["router","cable"]}}
After: { "order": { "id": 10428, "sum": 4290, "items": [ "router", "cable" ] } }
Trailing comma in a config file
Before: {"host": "db.local", "port": 5432,}
After: Parse error: unexpected } — remove the comma that follows 5432