Skip to tool content
Toolioz logoToolioz
Data Formatting

JSON Formatter

JSON is formatted with 2 or 4 spaces, minified, or written as YAML or TypeScript. Parsing stays in the browser.

Raw JSON Input

Formatting
Advanced Generics

Result

(Output appears here after the text is formatted)
Quick Summary & Direct Answer
Developer Utilities

Format, validate, and convert JSON to TypeScript or YAML

This page pretty-prints JSON with 2 or 4 spaces, minifies it, and can emit YAML or TypeScript from a value that parses. The text is not uploaded. The site still loads scripts and analytics.

Key Takeaways

  • Pasted JSON stays in the tab when the page is labelled local processing. Analytics for the website still load.
  • TypeScript interfaces come from json-to-ts and the parsed sample.
  • The YAML converter turns parsed JSON into YAML syntax.
  • A parse error shows the JSON.parse message. The page does not highlight a line.

Frequently Asked Questions

Formatting and conversion run in this tab when the page is labelled local processing. The JSON is not uploaded to Toolioz. The website still loads scripts and analytics.

YAML uses js-yaml with an indent of 2. TypeScript uses the json-to-ts package on the parsed value. Both run after JSON.parse succeeds. The text is not uploaded.

JSON.parse rejects trailing commas, single quotes, and unquoted keys. The page shows that parser message. It does not draw a line highlight. The text is not uploaded.

Publisher notes · reviewed 10 September 2026

What this JSON formatter does with invalid input

The formatter pretty-prints JSON that already parses, and it reports the first syntax error when the text is not JSON. It is not a schema validator and it does not send the document to Toolioz when the page is labelled local processing.

Parse errors you will actually see

JSON requires double-quoted keys, no trailing commas, and no comments. A trailing comma after the last property is valid in JavaScript objects and invalid in JSON. Single quotes around strings fail. `undefined` is not a JSON value. The engine stops at the first violation and shows a position; fix that before looking for a second error.

Huge minified files can freeze a tab because parsing is synchronous on the main thread. Split the file or use a desktop tool if the browser complains. Formatting does not prove the payload matches an API contract. That check is JSON Schema, on a different page.

Privacy note

Tokens, passwords, and PII pasted here stay in the tab only if the page states local processing. The website still loads scripts and analytics. Do not paste production secrets into any website, including this one, if your policy forbids it.

Worked examples

  • Trailing comma

    {"ok": true,} fails. {"ok": true} parses. Remove the comma after true.

Limits of this page

  • Does not repair YAML, TOML, or JavaScript object literals automatically.
  • Duplicate keys: JSON.parse keeps the last value; that may not be what the API author intended.

Sources