Skip to content
JSON Toolkit
Guides

How to Format, Validate, and Repair JSON Online

June 5, 20268 min read

Almost every JSON headache comes down to three needs: make it readable, prove it's valid, and fix it when it isn't. The Format & Validate tools cover all three. This guide walks through beautifying and minifying, validating with line-and-column precision, and automatically repairing broken JSON — including the kind you paste out of logs and chat tools.

The Format & Validate toolkit

Four tools work together to get raw JSON production-ready:

  • JSON Formatter — beautify, minify, and sort keys.
  • JSON Validator — check syntax against the JSON standard.
  • JSON Repair — auto-fix broken or non-standard JSON.
  • JSON Editor — edit in a full code editor with live validation.

Formatting: beautify, minify, and sort keys

Beautifying adds consistent indentation and line breaks so a human can read the structure — ideal for debugging an API response or reviewing a config file. Minifying does the reverse, stripping all whitespace to produce the smallest possible payload for the network.

Sorting keys alphabetically is the underrated one: it gives every document a deterministic order, which makes version-control diffs clean and review-friendly instead of noisy.

Validating: catch errors with line and column precision

The Validator checks your JSON against RFC 8259, the official specification, so its verdict matches what strict parsers in production will accept. When something is wrong, it points to the exact line and column and explains the problem in plain English — a missing comma, an unquoted key, a trailing comma — rather than dumping a cryptic parser error.

Repairing broken JSON automatically

Often JSON isn't quite valid but the intent is obvious. The Repair tool tolerantly parses common mistakes and rewrites them into strict, standards-compliant JSON, showing a plain-English log of every fix it applied so nothing happens silently.

It handles the usual suspects and then some:

  • Trailing commas, single or backtick quotes, and unquoted keys.
  • // and # comments stripped out.
  • Python literals (True, False, None) and JavaScript NaN, Infinity, undefined.
  • Markdown code fences around JSON pasted from ChatGPT or logs.
  • Unterminated strings and missing closing brackets in truncated payloads.

Editing in a real code editor

When you'd rather fix things by hand, the JSON Editor is built on Monaco — the same engine that powers Visual Studio Code. You get familiar shortcuts, bracket matching, folding, a minimap, and live validation that underlines mistakes the moment you type them.

A typical workflow

These tools chain together naturally:

  • Paste your raw JSON into the formatter or editor.
  • If it's invalid, let the repairer fix it and review the change log.
  • Validate to confirm it's clean against RFC 8259.
  • Beautify (or sort keys) for readability, or minify to ship it.
  • Copy or download the result.

Why do it here

Everything runs client-side, so sensitive payloads never leave your browser. The tools validate as you type, work on large files, and are completely free with no sign-up, no limits, and no ads.

Try it yourself

Beautify, minify, and repair messy JSON — even Python dicts and JS objects — into clean, valid output.

Open JSON Formatter