JSON Formatter & Validator

Paste raw or minified JSON — even slightly invalid JSON with unquoted keys or trailing commas — to pretty-print it with syntax highlighting, minify it, validate it with the exact error location, or escape it as a string literal.

Runs entirely in your browser — nothing is sent to our servers.

How to use it
  1. Paste your raw, minified, or slightly invalid JSON into the input panel.
  2. The Valid JSON indicator next to the input updates live and shows the exact error position if your input isn't strict JSON.
  3. Switch to Beautify to pretty-print, or Minify to compact it, as you type. Both auto-repair common invalid JSON and flag when they did. Pick an indent width if you want something other than two spaces.
  4. Switch to Transform to convert a non-JSON (key=value, ...) tuple — e.g. a Java/Kotlin toString() dump — into JSON.
  5. Switch to Stringify or Unstringify to escape or unescape the JSON as a string literal.
  6. Press Copy to put the result on your clipboard, or Clear to start over.

Valid JSON — formatted

Input

Valid JSON

Output

{
  "id": 42,
  "name": "a2zutil.dev",
  "tags": [
    "json",
    "tools"
  ],
  "active": true
}

What is JSON formatting?

JSON (JavaScript Object Notation) is the default data format for web APIs, config files and logs. Machines happily read it as one long line, but people cannot. JSON formatting — also called pretty-printing or beautifying — re-indents that single line into a nested, readable structure so you can see which keys belong to which objects and where an array begins and ends.

Formatting also acts as a validation step. A formatter has to parse the document before it can re-print it, so an unterminated string, a trailing comma or a missing brace surfaces immediately with the position where the parser gave up. That is usually faster than hunting for the problem by eye.

Minifying is the reverse operation: every optional space and newline is stripped so the payload is as small as possible for transport or storage. Stringifying wraps the whole document in quotes and escapes it, which is what you need when JSON has to be embedded inside another JSON field, an environment variable, or a test fixture.

Why use this JSON formatter

It runs entirely in your browser. Nothing you paste is uploaded, logged or stored, which means you can safely format a real API response containing customer records or internal IDs — something you should never do on a site that posts your input to a server.

It is also fast and free with no request limits, no account, and no interstitial ads over the editor. The tool area is deliberately kept clean; explanatory content lives below it, out of your way.

Beyond pretty-printing, you get minify, a live validity check with line and column reporting, and both directions of string escaping in a single page, so you rarely need a second tab.

Common JSON errors, decoded

Trailing commas and unquoted keys

A trailing comma after the last item in an object or array — easy to leave behind after deleting a field — is valid in JavaScript object literals but not in strict JSON, and is one of the most common validation failures for hand-edited config files. Unquoted keys and single-quoted strings are the other frequent source: a payload copy-pasted out of JavaScript source code — an object literal rather than a JSON document — fails strict validation for exactly this reason. Beautify and Minify now repair all three automatically: unquoted or single-quoted keys get double-quoted, single-quoted string values are re-quoted, trailing commas are dropped, // and /* */ comments are stripped, and Python/JS-style True/False/None/undefined are mapped to their JSON equivalents — so something like {email:george@mail.com} becomes {"email":"george@mail.com"} without manual cleanup. The Valid JSON indicator next to the input still reports strict-JSON errors with the exact position as you type, since its job is to tell you whether the raw input is standards-compliant — independently of whichever mode is repairing it for output.

Converting a toString() tuple with Transform

Transform handles input that isn't JSON-shaped at all: a Java or Kotlin-style toString() tuple, such as (amount=6.53,remember=false,reason=declined), gets converted into a proper JSON object — {"amount":6.53,"remember":false,"reason":"declined"} — with numbers, booleans and nulls inferred from the raw values.

Duplicate keys silently overwrite each other

Duplicate keys are a quieter issue because they don't fail validation at all — the JSON spec doesn't forbid them, and most parsers, including the browser's, silently keep the last occurrence and discard the earlier one. If a formatted document has fewer effective fields than you expect, scanning for an accidentally duplicated key is worth doing even though the formatter won't flag it as an error.

NaN, Infinity and undefined aren't valid JSON

NaN, Infinity and undefined are valid JavaScript but not valid JSON — a value serialized from a JavaScript number that happened to be NaN (a failed calculation, for instance) produces invalid JSON on the way out. The repair step maps all three to null, the closest lossless representation JSON has, but it's still worth checking for at the source, since re-parsing silently turns a calculation error into a null value downstream.

A free alternative to jsonformatter.org

jsonformatter.org and similar sites (freeformatter.com, curiousconcept.com) do the same basic job, but two things set this apart: what happens to your data, and what happens when the JSON is broken. Nothing here is uploaded — beautify, minify, validate and stringify all run in your browser, so pasting a payload with real customer data or API keys never leaves your machine.

And where most validators just point at the byte where parsing failed, the auto-repair here fixes the common breakages — trailing commas, single-quoted keys and values, unquoted keys, JS-style comments — so you get working JSON back instead of just an error message.

JSON formatter FAQ

Yes — formatting, minifying, validating and escaping JSON with no signup, and unlike many alternatives, everything runs client-side, so your JSON is never uploaded to a server. It also auto-repairs common invalid JSON (trailing commas, single quotes, unquoted keys) rather than only pointing out the error.

No. Parsing and formatting happen in your browser with the native JSON engine (falling back to a local repair parser for invalid input). The text never leaves your device.

Yes. Beautify and Minify automatically repair unquoted/single-quoted keys, single-quoted string values, trailing commas, // and /* */ comments, and Python-style True/False/None. The status message tells you when a repair happened, e.g. {email:george@mail.com} becomes {"email":"george@mail.com"}.

Yes — switch to Transform. It recognizes Java/Kotlin-style toString() output — a parenthesized, comma-separated list of key=value pairs, e.g. (amount=6.53,remember=false,reason=declined) — and converts it into a JSON object: {"amount":6.53,"remember":false,"reason":"declined"}. Numbers, booleans and nulls are inferred; everything else becomes a string.

It checks strict JSON compliance and reports the exact line and column where parsing stopped, live as you type. If the input is fixable, the message says so — switch to Beautify to auto-repair it.

Minify removes whitespace but keeps the document as JSON. Stringify converts the whole document into a single escaped string value that can be embedded inside another JSON document.

Large documents work, but everything runs on the main thread of your browser, so multi-megabyte payloads may pause the page briefly while parsing.

Only whitespace changes for already-valid JSON. When repair runs on invalid input, the fixes are limited to quoting, comma and literal cleanup — no values are reinterpreted, except NaN/Infinity/undefined, which become null since JSON has no equivalent.

Yes — two, four or eight spaces via the indent selector next to the action buttons.

No. There is no limit, no account and no cost.