JSON Formatter
JSON Formatter pretty-prints or minifies JSON in your browser. Paste an object, array, or API payload, parse it locally with JSON.parse, then copy two-space or compact output. Nothing is uploaded, stored in localStorage, or sent to a formatter API. Invalid JSON (trailing commas, comments, single quotes) is rejected so the copy stays RFC 8259.
Updated
The first job of this page is to turn messy or minified JSON into readable text, or the reverse, without a paste-bin. Invalid JSON — trailing commas, comments, single quotes — is rejected next to the input so the output stays RFC 8259 JSON you can paste into an API. Enable sort keys when you want alphabetical keys for a diff. Closing the tab drops the payload; we do not write it to localStorage.
Paste an object, array, or API response. Standard JSON only — no comments or trailing commas.
Output
Pretty-printed JSON will appear here.
How does the JSON Formatter work?
1. Paste JSON
Drop in an object, array, or JSON text — including typical copy from an API response. An India-first example is available from Load example.
2. Parse locally
The browser’s JSON.parse runs in this tab. Invalid JSON gets an error next to the input; we do not send the blob anywhere.
3. Pretty-print or minify
Use the toolbar to choose two-space indent or a compact minified form. Enable sort keys if you want alphabetical keys for diffs.
4. Copy the result
When the JSON is valid, copy the formatted output. Closing the tab drops the payload.
Questions about JSON Formatter
- Does JSON Formatter upload my payload?
- No. Parsing and formatting run in the browser. There is no account and no server-side formatter. The text you paste stays in this tab until you clear it or close the page. We do not write it to localStorage. That is the same privacy rule as JWT Token Decrypt on this hub.
- Can JSON Formatter fix trailing commas?
- No. The tool formats standard JSON. Trailing commas, comments, and single quotes are rejected as invalid JSON, and the error appears next to the input rather than failing silently. If you need to accept JSON5 or JSONC, use an editor that documents that dialect. This page stays strict so the output is safe to paste into APIs that expect RFC 8259 JSON.
- Is the pretty-printed output stable for diffs?
- Pretty-print uses two-space indent and JSON.stringify’s default key order, which is insertion order in modern engines. Enable sort keys in the toolbar if you want alphabetical keys before you copy. Minify emits a single line. Neither mode reorders array items. For very large documents, prefer a local CLI; this page is meant for typical API payloads.
- What about very large JSON files?
- The page is meant for typical API payloads. Multi-megabyte documents may strain the tab; keep large jobs on your own machine with a local CLI. There is no upload size limit because nothing is uploaded — the limit is whatever your browser can parse in memory without becoming unresponsive.
- Does JSON Formatter validate against a schema?
- No. It only checks that the text is valid JSON and then reprints it. A green valid state means the parser accepted the document, not that the shape matches an OpenAPI or JSON Schema file. For schema checks, use a dedicated validator. This page is a formatter with a copy control.
- Can I choose a different indent, like tabs or four spaces?
- No. Pretty-print is fixed at a two-space indent, and minify collapses everything to one line — there is no tab or four-space option in the toolbar. Both outputs are still valid JSON; if your project standard needs a different width, paste the two-space result into your own editor and reindent there. Sort keys works the same way with either output mode.
- What happens with very deeply nested JSON?
- Nesting depth, not file size, is the real risk. JSON.stringify recurses once per level in the browser, so an extremely deep structure — tens of thousands of nested arrays or objects — can throw a stack-overflow-style error (RangeError: Maximum call stack size exceeded in V8-based browsers) even when the file itself is small. Typical API payloads, which nest a few dozen levels at most, format without issue. If you hit that error, the JSON is valid but too deep for this tab; flatten it or reformat with a local CLI instead.
- How does JSON Formatter treat duplicate keys?
- JSON does not define duplicate object keys, but browsers keep the last value when the same key appears twice in one object. This formatter uses the browser’s JSON.parse, so a duplicate key is not flagged as an error — the earlier value is dropped before pretty-print or minify runs. If you need to detect collisions, check the source in an editor that highlights duplicates. Sorted-key output still reflects only the surviving keys after parse.
What else can I open?
- JWT Token DecryptDecrypt a compact JWE locally with Web Crypto.
- JSON Schema GeneratorGenerate a JSON Schema from a JSON sample in the browser — no upload.
- YAML FormatterPretty-print and validate YAML in the browser — keeps YAML as YAML, nothing uploaded.
- JWT Token GeneratorCreate and sign a compact HS256 JWT locally in the browser.
- Timestamp to DateConvert Unix timestamps to UTC and local dates in the browser.
- Password GeneratorGenerate strong random passwords locally with crypto.getRandomValues.
These tools run in your browser. Page Utils does not store, upload, or write to localStorage the keys, tokens, or text you paste. Results are a convenience aid, not legal, tax, or security advice.