JSON Formatter

Format JSON with two-space indentation or minify it while preserving the original number text, string escapes and key order. Check syntax, convert an object to query parameters, or escape and unescape text for a JSON string.

Runs locally in your browser

Format an API response or compact a JSON value

JSON input can be an object, array, string, number, boolean or null. Syntax errors identify a line and column; comments and trailing commas are rejected. This is syntax checking, not JSON Schema validation or automatic repair.

Paste your input; file uploads and remote URL fetching are unavailable, formatting and text conversions run in your browser, and large inputs depend on browser memory.

  1. Paste JSON into the source field to see its formatted preview.
  2. Choose formatting for two-space indentation or minification to remove whitespace outside strings.
  3. Review the output, then use the copy control.

Numbers, query values and escaped text

Keep the number as written

Formatting and minification preserve 9007199254740993, 1.234567890123456789, 1e400 and 1e-400 exactly as text. They also retain -0, trailing decimal zeros such as 1.2300, and exponent notation. Another program can still lose precision when it parses that output as floating-point numbers.

One query parameter per top-level property

Query conversion requires an object. Strings become decoded text, null becomes an empty value, and booleans and numbers become text, preserving numeric spelling. Nested objects and arrays become compact JSON strings, not bracket paths.

For example, {"q":"a b&c","user":{"id":9007199254740993}} becomes q=a+b%26c&user=%7B%22id%22%3A9007199254740993%7D. The result is already form-URL-encoded: spaces become + and reserved characters are percent-encoded. Do not encode it again. No leading ? is added.

Escape a string fragment without outer quotes

Escape accepts arbitrary text and preserves leading and trailing whitespace. Two lines, A followed by B, become the literal fragment A\nB. Unescape takes that fragment without surrounding double quotes and restores the newline. Tabs and control characters are escaped too; invalid sequences such as \q are rejected when unescaping.

JSON formatting questions

What happens to duplicate keys?

Formatting and minification preserve both members in {"a":1,"a":2}, but downstream parsers may interpret them differently. Query conversion rejects duplicate top-level keys.

Does Unicode conversion validate JSON?

No. It converts non-ASCII UTF-16 code units to literal \uXXXX sequences, using surrogate pairs for supplementary characters. Decoding replaces valid tokens and leaves malformed ones unchanged. Existing literal \u0041 becomes A, so mixed text is not guaranteed to round-trip.

Recent tools: