omnitool / Dev & Cloud / JSON Formatter

JSON Formatter, Beautifier, Minifier & Syntax Validator

Validate, pretty-print (2-space indent), and minify JSON payloads directly in your browser with zero server uploads. Interactive browser-local JSON Formatter (UTF-8 Byte Size (Minified vs Pretty): 149 B minified • 188 B pretty (-20.7%)).

Maintained by: OmniTool Systems & Web Engineering Desk Last Reviewed: 2026-10-20 (Updated 2026-10-25) Documentation: Formula & Source Policy
Presets:
Valid RFC 8259 JSON (2-Space Pretty-Print)
{ "service": "api-gateway-v2", "region": "us-east-1", "rateLimitRps": 2500, "tls13Enabled": true, "endpoints": [ "/v2/tokenize", "/v2/embeddings", "/v2/healthz" ] }
UTF-8 Byte Size (Minified vs Pretty)
149 B minified • 188 B pretty (-20.7%)
Root JSON Type & Structure
object (5 top-level keys)
RFC 8259 verified (max 512 KB / 524,288 UTF-8 bytes browser-local limit). Toggle Pretty-Print or Minify JSON, or click Copy Minified.

RFC 8259 Valid vs Invalid JSON Syntax Quick Reference

Common syntax differences between JavaScript object literals and strict IETF RFC 8259 JSON parsers:

Syntax ConstructInvalid Example (Throws Error)Valid RFC 8259 JSONRFC 8259 Rule
Trailing Comma{"a": 1, "b": 2,}{"a": 1, "b": 2}No comma allowed after final member/element
String & Key Quotes{'env': 'prod'}{"env": "prod"}Keys and strings must use double quotes (")
Comments{"port": 443 // TLS}{"port": 443}Comments (// or /* */) are not part of JSON
Special Numbers{"score": NaN, "max": Infinity}{"score": null, "max": 1e308}NaN, Infinity, and hex (0xFF) are forbidden
Root Primitivesundefinednull, true, 42, or "ok"Any single JSON value is valid root text (Sec. 2)

Mathematical Formula & Step-by-Step Guide

Primary mathematical equation used by this model:

RFC 8259 JSON.parse() Syntax Validation + 2-Space Pretty-Print + TextEncoder UTF-8 Byte Size Analysis
  1. Paste any JSON object, array, or standalone RFC 8259 primitive (up to 512 KB / 524,288 UTF-8 bytes) into the private local workspace above.
  2. Toggle between 'Pretty-Print (2-Space)' for human inspection and 'Minify JSON (1-Line)' to strip all insignificant whitespace for HTTP payloads.
  3. Click 'Copy Output' (copies active view) or 'Copy Minified' (copies 1-line compact JSON directly), and compare exact UTF-8 byte sizes before and after minification.
Primary Standards & References: IETF RFC 8259 (The JavaScript Object Notation Data Interchange Format) & ECMA-404 JSON Data Interchange Syntax (Reviewed 2026-10-25).
Validates all RFC 8259 root values (objects, arrays, strings, numbers, booleans, and null) and measures exact UTF-8 byte length via TextEncoder.

Frequently Asked Questions — JSON Formatter

How do I minify JSON vs pretty-print JSON in this tool, and what is the maximum input size?
Click 'Minify JSON (1-Line)' to switch the output panel to compact 1-line JSON (removing all non-string whitespace via JSON.stringify(parsed)), or click 'Copy Minified' at any time to copy the minified payload directly to your clipboard. Click 'Pretty-Print (2-Space)' to restore indented formatting. To keep the browser UI responsive without server uploads, input is capped at 512 KB (524,288 UTF-8 bytes) processed 100% locally in your browser.
Why does JSON.parse throw 'Unexpected token }' when my object works in JavaScript?
IETF RFC 8259 strictly forbids trailing commas after the last item in an object or array, single-quoted strings ('key'), unquoted property names, // comments, and NaN/Infinity literals—even though standard JavaScript source code permits them.
Is my JSON payload ever sent to a server or stored in the URL when I click Copy Tool Link?
No. Parsing, validation, pretty-printing, and minification execute 100% locally inside your browser's JavaScript engine. Your JSON input is never transmitted to any server and is never encoded into the page URL—clicking 'Copy Tool Link' copies only the clean tool address.