JSON Formatter
Format, validate, and minify JSON with syntax error detection and line numbers. Free online JSON beautifier and validator, 100% in your browser.
Reference
What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based data-interchange format defined in RFC 8259 and ECMA-404. It is the dominant format for REST APIs, configuration files, and data storage in web applications. JSON supports six value types: object, array, string, number, boolean, and null. Formatting (pretty-printing) adds indentation and line breaks to make compact JSON human-readable without changing the data — any valid parser produces identical results from formatted or minified input.
How does JSON validation work?
JSON has strict syntax rules that differ from JavaScript object literals. Keys must be double-quoted strings ("key", not key or 'key'). Trailing commas after the last element are forbidden. Strings must use double quotes, not single quotes. Comments are not allowed. Only the six value types above are valid — undefined, functions, and NaN/Infinity are not valid JSON. This tool uses the browser's native JSON.parse() to validate — if the input is not valid JSON, the exact error message and position are displayed so you can pinpoint and fix the problem.
JSON minification
Minifying JSON removes all insignificant whitespace (spaces, tabs, newlines) to produce the smallest possible representation. A typical API response can shrink by 30–60% after minification. This matters for network performance: smaller payloads reduce Time to First Byte (TTFB) and improve mobile load times on slower connections. The savings are displayed after minification so you can see the exact size reduction. Note that minification works best alongside server-side gzip or Brotli compression — the two techniques are complementary, not redundant.
Privacy
All processing runs 100% in your browser. No data is sent to a server.