Back to tools

Browser-only data tool

JSON Formatter & Validator

Validate, format, minify, alphabetically sort, and summarize JSON entirely inside your browser.

Inspect and transform JSON

Parsing and formatting run entirely in this browser tab.

0 bytes

More than pretty printing

The workbench parses input with the browser's standards-compliant JSON parser, so it first answers whether the text is actually JSON rather than merely looking like JavaScript. Format writes two-space indentation, Minify removes insignificant whitespace, and Sort keys recursively orders object keys while preserving array order. After a successful action, the summary counts object keys, values, objects, arrays, and maximum nesting depth. Those measurements are useful when reviewing unfamiliar API responses or spotting an unexpectedly deep payload.

What valid JSON permits

JSON has stricter rules than JavaScript object literals: property names and strings require double quotes, trailing commas and comments are forbidden, and NaN, Infinity, undefined, functions, dates, and BigInt are not JSON values. The root may be an object, array, string, number, boolean, or null. Parsing also applies JSON's number model, so very large integers can lose precision when represented as JavaScript numbers. If an identifier must remain exact, transmit it as a quoted string.

A worked example

Paste {"b":2,"a":{"items":[true,null]}} and choose Format to see its hierarchy with indentation. The summary reports two objects, one array, four object keys, six total values, and a maximum depth of three. Sort keys moves a before b but does not reorder the items array, because array position is semantic. Minify then produces a compact transport representation. Whitespace changes do not alter the parsed data, but sorting keys changes textual order and therefore changes any checksum calculated over the original bytes.

Privacy and performance boundaries

The text remains in this browser tab and no formatter API is called. That is useful for private configuration fragments, but the page cannot protect data already exposed to browser extensions, shared clipboards, screen recording, or a compromised device. Very large or deeply nested documents consume memory because parsing creates a complete in-memory value before writing the result. The interface warns above 1 MB; for multi-gigabyte logs or untrusted decompression output, use a streaming command-line parser instead.

FAQ

  • Does key sorting change my data? — It preserves values and array order, but changes object key order and the exact byte representation.
  • Why are comments rejected? — Standard JSON has no comments. JSON5 and JavaScript object literals are different formats.
  • Why did a long integer change? — JavaScript numbers cannot exactly represent every integer beyond 9,007,199,254,740,991; encode large identifiers as strings.
  • Is pasted JSON uploaded? — No. Parsing, formatting, sorting, and counting run locally in the browser.