How to Read, Fix and Shrink JSON and HTML
Updated 19 October 2026 · 6 min read
Turn one-line API responses and messy markup into something readable, find the comma that breaks your JSON, minify it for embedding, and fill templates with placeholder text.
APIs and build tools produce JSON and HTML for machines: one long line, no indentation, and no forgiveness for a single stray character. Four small tools cover nearly every situation, and they all run in your browser, so tokens and customer data you paste are never sent anywhere.
Which tool for which job
| You want to | Use |
|---|---|
| Read a one-line API response | JSON Formatter |
| Find out why JSON is rejected | JSON Validator |
| Make JSON as small as possible | JSON Minifier |
| Read or tidy messy markup | HTML Formatter |
| Fill a layout or template with dummy text | Lorem Ipsum Generator |
Make JSON readable
Paste JSON into the formatter and it is printed back with two-space indentation and one property per line, so nested objects and arrays line up. Keys, values and order are kept exactly; only whitespace changes.
Integers larger than about 9 quadrillion, such as some database IDs, can lose precision in any JavaScript-based tool. If your JSON has huge unquoted numbers, check them after formatting.
Find what breaks your JSON
The validator uses the same strict parser as browsers and reports the error with its line and column when available. These five mistakes cause most failures:
| Mistake | Invalid | Valid |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 'b'} | {"a": "b"} |
| Unquoted keys | {a: 1} | {"a": 1} |
| Comments | {"a": 1 // note} | JSON has no comments |
| Special values | {"a": undefined} | {"a": null} |
- Unexpected token usually means a trailing comma, a single quote or a comment.
- Unexpected end of JSON input means something was not closed, or the text was cut off when copying.
- The reported position is where the parser gave up, often just after the real mistake, so check the line above too.
- JSON copied from chat apps or documents may have curly “smart” quotes instead of straight ones.
This checks syntax only. Whether the data has the right fields for a particular API is a separate question for a schema validator.
Shrink JSON for embedding
The minifier removes every space and line break outside strings, usually saving 20–40% on indented JSON. It is useful for environment variables, HTML attributes, single-line logs and database columns. For JSON sent over HTTP, server compression already removes most of that whitespace, so readable JSON is often fine for APIs you debug.
Tidy HTML
The HTML formatter re-indents markup from page sources, email templates and CMS exports, with each child element on its own line. Tags, attributes and text are kept. If formatting fails, look for a tag that is never closed or is closed in the wrong order, such as <b><i>text</b></i>. Browsers repair such markup silently, which is why a page can look fine while its source is broken.
Placeholder text for templates
When a layout or email template needs realistic-looking text before the real copy is ready, generate paragraphs, sentences or words of Lorem Ipsum. Search for “lorem” before publishing so none is left on a live page, and test with longer text too, because real headlines and translated text are often much longer than designers expect.

