Overview
JSON formatting / minifying / validating is one of the most-used daily dev tools — from API debugging to log triage to config file cleanup. This tool offers Format, Minify, and Validate modes using the browser's native JSON parser, with customizable indent (0-8 spaces). Large inputs (>5MB) use useDeferredValue to avoid typing lag. Everything runs locally in your browser — JSON never leaves your machine, so you can safely paste tokens or internal API responses for debugging.
How to use
- Pick mode at top: Format (pretty multiline), Minify (single line), Validate (check only)
- Paste JSON into the input box
- Result shows instantly (invalid JSON renders a red error row with precise location)
- In Format mode, adjust indent spaces (default 2)
Formula
Under the hood: browser's native JSON.parse(input) → JS object → JSON.stringify(obj, null, indent). Format: JSON.stringify(parsed, null, indent) [0..8 clamped] Minify: JSON.stringify(parsed) [no whitespace] Validate: JSON.parse only; ok=true if no throw Error handling: try/catch around parse, never throws/alerts; error msg includes char offset.
Common scenarios
Scenario 1 · Debug a compressed API response
Backend returns single-line minified JSON that's unreadable. Paste → Format → instantly see the structure. Invalid JSON shows a precise error with char offset.
Scenario 2 · Embed JSON in an HTML attribute
data-props='{"a":1}' type attrs need minified JSON. One click on Minify mode, done.
Scenario 3 · Validate a 3rd-party webhook payload
Suspicious webhook body? Paste → Validate → only checks legality without modifying. Trailing commas / unquoted keys surface immediately.
FAQ
Is my JSON uploaded to your server?
No. All parsing, formatting, and validation run locally in your browser. JSON never leaves your device — safe to paste tokens or internal API responses.
What's the size limit for JSON input?
No hard cap — depends on browser memory (typically 512MB-2GB in modern browsers). Inputs >5MB may feel slow; we use useDeferredValue to mitigate typing lag.
Why isn't the error message more precise when parsing fails?
The error comes straight from the browser's native JSON.parse, which includes char offset but not always line number. Firefox / Chrome / Safari differ slightly; we surface the raw msg to avoid wrapping misdirection.
Can it auto-read from clipboard?
No auto-clipboard read (requires user permission, inconsistent browser support). Manual Cmd/Ctrl + V paste is straightforward and avoids permission prompts.
Does it support JSON5 / JSONC (JSON with comments)?
Not supported. This tool uses native JSON.parse per RFC 8259 — no trailing commas, unquoted keys, or // comments. JSON5 / JSONC need separate parsers, which this tool avoids.
Is formatted content cached locally? Does it persist next visit?
No. The tool does not read/write localStorage or IndexedDB; refreshing the page clears everything. Copy the result to your own file to save.
Related tools
Online ID Photo Maker: Background, Crop & Compress
Upload any portrait to create standard ID photos in one click. Auto background removal with blue/white/red swap, smart crop to passport/visa sizes and compression to target KB, fully local in browser.
PDF to Image Converter - Free Online PDF to JPG/PNG Tool
Free online PDF to image converter. Convert PDF pages to JPG or PNG with custom DPI and page range. Batch export as ZIP. 100% browser-local processing, no upload, fully private and secure.
Image Cropper Online - Free & Aspect Ratio Crop Tool
Free online image cropper supporting 1:1, 4:3, 16:9, 3:4, 9:16 fixed ratios and free crop. Drag to select or input exact pixel values. Pure browser Canvas, keeps PNG transparency, no upload.
Online Image Stitcher - Combine Multiple Images Into One Long Image
Stitch multiple images vertically or horizontally into one long image locally in your browser. Drag to reorder, customize gap and background, export as PNG/JPG/WebP. No server upload.