---
title: "JSON formatter, pretty printer & validator | Austin Greco"
description: "Format, pretty print, minify and validate JSON in your browser. Find syntax errors by line and column while preserving large numbers and duplicate keys."
canonical: "https://austingreco.com/tools/json-formatter"
last_updated: "2026-10-23T01:52:28.000Z"
---

[Tools](https://austingreco.com/tools) · JSON formatter / validator

# JSON formatter / validator

Make JSON easy to read, compact it, or find a syntax error. Your numbers and original input stay intact.

## How to format and validate JSON

1.  Paste a JSON value into **Input** or load the synthetic **Example**. Validation runs as you type.
2.  Choose **Format** to pretty print with 2 spaces, 4 spaces, or tabs. Choose **Minify** to remove whitespace outside strings.
3.  If the input is invalid, select a **line and column** message to focus and select the problem in the original input. Correct it there; the tool does not repair or replace your text.
4.  Use **Copy** to copy valid output. **Clear** removes the current input and output.

For example, `{"name":"café","items":[1,true,null]}` becomes an indented object with a readable array. Minifying it returns the compact form. Unicode, emoji, and spaces inside a string are preserved.

## Common JSON errors

Missing quotes

`{name:"Ada"}` is invalid. Property names and strings require double quotes: `{"name":"Ada"}`. Single quotes are not JSON string delimiters.

Missing or extra commas

`[1 2]` needs a comma between its values. `[1,2,]` has a trailing comma, which strict JSON does not allow.

Truncated values

`{"name":"Ada` needs a closing quote and brace. A formatter cannot recover missing content or determine what the author intended.

JSON supports objects, arrays, strings, numbers, `true`, `false`, and `null`, with one root value. Comments, JavaScript expressions, `undefined`, `NaN`, and `Infinity` are not valid JSON. Error locations identify the token where the parser detected a problem; the underlying mistake can be earlier. Columns start at 1 and count UTF-16 code units, so an emoji can count as two.

## Numbers, duplicate keys and limits

Formatting changes only whitespace outside strings. It preserves key order, string escapes, and the exact spelling of numbers, including `9007199254740993`, `-0`, and `1.2300e+04`. It does not round numbers through JavaScript’s native `JSON.parse` and `JSON.stringify`.

`{"id":1,"id":2}` keeps both entries and shows a duplicate-key warning. Many parsers keep only the last value, so resolve duplicates before exchanging data. Escaped equivalents such as `"id"` and `"\u0069d"` count as the same key in one object.

This is a syntax validator, not a JSON Schema or application-data validator. Valid JSON can still contain incorrect values. Input is limited to 65,536 UTF-16 code units, 20,000 tokens, and 64 nesting levels; formatted output is limited to 262,144 characters. Larger output uses a plain code display to keep the page responsive. Up to eight syntax diagnostics and five duplicate locations are displayed.

Parsing and whitespace edits use [Microsoft’s jsonc-parser](https://github.com/microsoft/node-jsonc-parser/tree/v3.3.1) with comments and trailing commas disabled. JSON-only highlighting uses the same scanner. The script is served with this site, without a third-party editor or highlighting service. [Parser license](https://austingreco.com/licenses/jsonc-parser.txt).

## Privacy and related tools

Input and output stay in this page’s browser memory. Processing never evaluates the input, uploads it, logs it, adds it to the URL, or saves it in browser storage. The page still requests the site’s files when it loads. Leaving the page clears the tool’s state. Copy writes only the selected output to your clipboard, which your device or clipboard manager may retain. See the [site privacy details](https://austingreco.com/privacy).

-   [URL encode / decode](https://austingreco.com/tools/url-encode-decode) — Encode text for URLs and decode percent-encoded strings.
-   [Base64 encode / decode](https://austingreco.com/tools/base64-encode-decode) — Encode UTF-8 text as Base64 or Base64URL and decode it back.
-   [JWT explorer / creator](https://austingreco.com/tools/jwt-explorer) — Inspect JWT claims and timestamps, create HS256 tokens, and check signatures locally.

[Browse all browser tools](https://austingreco.com/tools).

Source: [JSON formatter / validator](https://austingreco.com/tools/json-formatter)
