JSON Formatter and Validator
Pretty-print, validate, repair and minify JSON without ever changing a value: big integers, duplicate keys and exotic number formats survive untouched, with warnings where other tools silently corrupt. Everything runs locally in your browser.
Review repairs before anything changes
Valid JSON, with interoperability warnings
Tip: press Ctrl+Enter (Cmd+Enter on Mac) in the editor to format. Drop a .json file anywhere on the editor to open it.
Loading... Private by design: your JSON never leaves the browser. No upload, no server, no logging.
A JSON formatter that cannot change your data
Most online formatters, and JavaScript itself, parse your document into JS values before
printing it again. That pipeline silently corrupts valid JSON: paste
{"id":9007199254740993,"a":1,"a":2} into a parse-and-stringify tool and
you get back an id ending in ...992 and a single "a" key. The data changed and nothing warned
you. This tool formats the original token stream instead: Format, Minify and Sort keys only
ever touch whitespace and ordering, so every number, string and duplicate key comes out
byte-for-byte as it went in. Integers beyond the JavaScript-safe range and duplicate keys are
flagged as warnings with exact positions, because they are real interoperability problems
your formatter should surface, not erase.
Everything happens locally. Your JSON is never uploaded, stored or logged. That matters because the JSON people debug in 2026 is rarely public: it is API responses full of tokens, webhook payloads, LLM tool outputs and production configs. A formatter you can safely paste secrets into has to be client-side, and this one is.
Repair with a preview, never a surprise
Strict JSON is smaller than most people expect. The specification allows no comments, no trailing commas, no single quotes, no unquoted keys, and no NaN or Infinity. Those habits come from JavaScript, JSON5 and config dialects like JSONC, and they cause the vast majority of parse failures. The Fix common mistakes button handles exactly these: it strips comments outside strings, converts single-quoted and smart-quoted strings, quotes bare keys, removes trailing commas, and replaces undefined with null. NaN and Infinity are your call: convert them to null, to quoted strings, or leave them alone.
Nothing is rewritten blind. The repair panel lists every change it intends to make, shows the repaired text, and tells you whether the result will actually be valid JSON before you apply it. After applying, Undo restores your original text.
Pretty-print for people, minify for production
Formatting is for humans reading a diff or debugging a payload. Production wants the opposite: minified JSON parses identically but drops whitespace, which cuts API responses and config files by 20 to 40 percent before compression even runs. Use two-space indentation for files that live in version control, sort keys alphabetically so diffs stay deterministic, and minify anything a machine consumes. If you build on WordPress, the same discipline applies to REST responses and plugin settings payloads.
JSON formatting and validation FAQ
Why is my JSON invalid when it looks correct?
The usual culprits are habits imported from JavaScript: a trailing comma after the last item, single quotes instead of double quotes, unquoted object keys, or NaN and Infinity as values. Copy-paste adds two more: smart quotes from Word or Slack, and invisible characters like non-breaking spaces. The validator above points at the exact line and column, and the Fix common mistakes button repairs comments, quote problems, bare keys, trailing commas, undefined, NaN and Infinity, showing you every change before it touches your text.
Can an online JSON formatter change my data?
Most can, and that is exactly why this one exists. Tools that run your JSON through the JavaScript JSON.parse() and JSON.stringify() functions silently round integers beyond 9007199254740991 (an ID like 9007199254740993 becomes ...992), collapse duplicate keys to a single value, and rewrite tokens like -0, 1e3 or 2.370. This formatter re-emits your original tokens and only changes whitespace, so Format and Minify can never alter a value. Anything risky, like a duplicate key or an unsafe number, is shown as a warning instead of silently changed.
What does "unsafe as a JavaScript number" mean?
JSON itself allows numbers of any size, but JavaScript stores them as 64-bit floats, which are only exact for integers between -9007199254740991 and 9007199254740991 (2 to the 53rd minus 1). RFC 8259 warns about exactly this interoperability gap. A database ID like 9007199254740993 is perfectly valid JSON, but the moment JavaScript parses it, it silently becomes 9007199254740992. This tool preserves the digits exactly and flags the number, so you know to handle it as a string or with BigInt on the JavaScript side.
Are duplicate keys allowed in JSON?
The grammar does not forbid them, but RFC 8259 says object names should be unique and that behavior is unpredictable when they are not: some parsers keep the first value, most keep the last, and a few error out. A formatter that quietly keeps one value destroys the evidence of the problem. This tool keeps every pair through Format and Minify, lists each duplicate with its line and JSON Pointer path, and only resolves them when you explicitly choose keep-first or keep-last, with Undo available.
Is it safe to paste sensitive JSON into this tool?
Yes. Everything runs as JavaScript inside your own browser tab. Your JSON is never uploaded, sent to a server, stored or logged, and the page makes no network requests with your data. You can load the page, disconnect from the internet, and the formatter keeps working. That makes it safe for API responses containing tokens, customer records or production configuration.
Should JSON be pretty-printed or minified in production?
Minify anything a machine consumes. Whitespace adds 20 to 40 percent to payload size before compression and buys nothing at runtime, since parsers ignore it. Pretty-print anything a human reads: files in version control, documentation examples and debug logs. Two-space indentation is the common convention for committed files because it keeps deep structures readable without excessive line width.
How large a JSON file can this tool handle?
Documents up to 25 MB are formatted and validated; above that the tool refuses rather than freeze your tab, since everything runs on the page itself. Above 3 MB the interactive tree view and syntax coloring switch off to keep the page responsive, and formatting a document near the limit can pause briefly. For multi-hundred-megabyte files, use a streaming command-line tool like jq instead of any browser-based formatter.
Does the order of keys in JSON matter?
Not to the specification: two objects with the same keys in different order are equivalent, and consumers must not rely on ordering. It matters to humans and to diffs. Sorting keys alphabetically makes committed config files deterministic, so version control shows real changes instead of reshuffles. The Sort keys A-Z toggle above reorders keys textually at every level while leaving every value token untouched.
More free tools: JSON Validator · JSON Tree Viewer · JSON Minifier · Base64 Encoder · Security Headers Checker