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
- Paste your raw, minified, or slightly invalid JSON into the input panel.
- The Valid JSON indicator next to the input updates live and shows the exact error position if your input isn't strict JSON.
- 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.
- Switch to Transform to convert a non-JSON
(key=value, ...)tuple — e.g. a Java/KotlintoString()dump — into JSON. - Switch to Stringify or Unstringify to escape or unescape the JSON as a string literal.
- Press Copy to put the result on your clipboard, or Clear to start over.
Valid JSON — formatted
Input
Valid JSONOutput
{
"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.
Related tools
JSON ↔ CSV
Convert a JSON array of objects to CSV, or back.
JSON Compare
Diff two JSON documents, path by path.
SQL Formatter
Indent queries with keyword casing options.
Case Converter
camelCase, snake_case, kebab-case, PascalCase and more, all at once.
Base64 Encoder / Decoder
Encode or decode Base64, including the URL-safe alphabet.
URL Encoder / Decoder
Percent-encode or decode a URL component.
UUID v4 Generator
Generate one or many cryptographically random UUID v4s.
Text Transform
Lines to a delimited list, and back.
Find & Replace
Regex, whole-word and case-sensitive search and replace, in place.
BIN Checker
Card issuer lookup from a BIN/IIN.
Temporary Email
A disposable inbox for live-testing incoming mail.
Webhook
Inspect live webhook deliveries.