JSON Formatter and Validator

Validate, format, minify, and sort JSON in your browser.

Format and validate JSON

Your JSON is parsed in this browser page and is never sent to a server.

JSON output

Ready to validate.

No valid JSON processed yet.

Your entries and results stay in this browser. This tool does not send, save, or add them to the page address.

How to format or validate JSON

Paste JSON, choose two spaces, four spaces, tabs, or minified output, and optionally sort object keys. Select Format JSON. Valid input produces normalized JSON and identifies the root value type; invalid input shows the parser error.

Safety and transformation behavior

The tool calls the browser’s standard JSON parser and serializer. It never evaluates the input as JavaScript. Recursive key sorting creates new object containers, sorts object keys, and preserves array order.

Minification removes insignificant whitespace. Pretty printing changes layout but should preserve values subject to JavaScript number representation.

Privacy and limitations

Processing runs locally in the page, but sensitive data may still be exposed through the device, clipboard history, browser extensions, screenshots, or other software. Do not paste secrets into an environment you do not trust.

JSON numbers are parsed as JavaScript numbers. Values beyond the safe-integer range or decimals requiring more precision can be rounded, and a number too large for that type, such as 1e999, becomes null in the output. Duplicate object keys are resolved by the parser, retaining the last value. Formatting checks syntax only: it does not validate application-specific schemas, and valid JSON is not necessarily correct or complete for your application.

Very deeply nested JSON exceeds the browser’s recursion limit. That is reported as an error rather than failing silently, but such documents cannot be formatted here. Very large documents are processed on the page’s main thread and can make the tab unresponsive while they run.

Key sorting compares UTF-16 code units, so the same document always sorts the same way here regardless of your device’s language. It is not a canonicalization feature, and it will not always agree with another tool.

Two differences are worth knowing. Keys that look like whole numbers come out in numeric order — 1, 2, 9, 10 — because JavaScript objects always list integer-like keys that way; most other formatters give 1, 10, 2, 9. And a character outside the basic multilingual plane, such as an emoji, sorts before characters in the U+E000U+FFFF range here, while tools comparing by Unicode code point put it after.

Frequently asked questions

Does this execute JSON as JavaScript?

No. It uses the browser's JSON parser and serializer. It does not use eval or execute values as code.

Does sorting keys change arrays?

No. Object keys are sorted recursively, while array element order remains unchanged.

Can formatting change large numbers?

Yes. Browser JSON parsing represents numbers with JavaScript's numeric type, so integers beyond the safe-integer range and very precise decimals can lose precision.

Is JSON with comments or trailing commas accepted?

No. Standard JSON does not allow comments, trailing commas, undefined, NaN, Infinity, or single-quoted strings.