JSON Formatter & Validator

Your data never leaves your browser

Format, validate, and minify JSON. Runs 100% in your browser. Your data never leaves your device.

Input
Output
Ctrl+Shift+CCopyCtrl+KClearCtrl+DDownload

Share this tool

Found it useful? Help a fellow developer discover it.

https://developertoolkit.dev/tools/json-formatter

What is a JSON Formatter?

A JSON formatter (also called a JSON beautifier or JSON pretty printer) takes raw, minified, or poorly indented JSON and reformats it with consistent indentation and line breaks, making it easy to read and debug. This tool also validates your JSON against the ECMA-404 standard, detects duplicate keys (which are technically undefined behavior per the spec), warns about integers that exceed JavaScript's Number.MAX_SAFE_INTEGER (common with Snowflake and Twitter IDs), and optionally strips JSONC-style comments and trailing commas so VS Code settings files and tsconfig.json can be formatted too. All processing happens client-side. Nothing is ever sent to a server.

How to use the JSON Formatter

  1. Paste or type your JSON into the left input panel.
  2. Click Format (or press Ctrl+Enter) to pretty-print with your chosen indent size.
  3. Click Minify to strip all whitespace for a compact payload.
  4. Use the Sort keys toggle to alphabetize object keys at every nesting level.
  5. Click Copy to copy the output, or Download to save it as a .json file.

When to use a JSON formatter

Frequently Asked Questions

How do I format minified JSON to make it readable?

Paste the minified JSON into the input panel. The formatter detects it automatically and applies consistent indentation when you click Format or press Ctrl+Enter. Use the indent size selector (2 or 4 spaces, or tabs) to match your project style.

Why is my JSON showing as invalid?

The most common causes are: trailing commas after the last item in an array or object (not allowed in standard JSON), single-quoted strings (JSON requires double quotes), unquoted or numeric keys, JavaScript-style comments, or a missing closing brace or bracket. Enable the JSONC toggle to handle comments and trailing commas automatically.

Is my JSON data kept private?

Yes. All formatting and validation runs entirely in your browser using JavaScript. Your JSON is never sent to any server. This tool works offline after the initial page load.

Why does the formatter warn about large numbers?

JavaScript's number type uses 64-bit floats, which can only represent integers exactly up to 2^53-1 (9,007,199,254,740,991). Numbers like Snowflake IDs (used by Twitter/X, Discord, etc.) exceed this limit. If you parse such JSON with JSON.parse(), the integer will be silently rounded, causing bugs. This tool warns you so you can handle these values with a BigInt-aware parser.

What is JSONC and does this tool support it?

JSONC (JSON with Comments) is a superset of JSON that allows // and /* */ comments and trailing commas. It is used by VS Code settings files and tsconfig.json. This tool automatically detects and handles JSONC, but warns you because standard JSON parsers will reject it.

What does "sort keys" do?

Sort keys alphabetizes every object's keys at all nesting levels. This is useful for diffing two JSON blobs (identical data but different key order will produce no diff after sorting) or for normalizing output from different API versions.

What is the difference between Format and Minify?

Format adds indentation and line breaks to make JSON human-readable. Minify removes all unnecessary whitespace to produce the smallest possible JSON string, which is useful for network payloads and storage.

Why are duplicate keys a problem?

The JSON specification (ECMA-404) says that object key names SHOULD be unique, but does not require it. Different parsers handle duplicates differently: some keep the first value, some keep the last, and some throw an error. Relying on duplicate keys makes your JSON unpredictable. This tool warns you when it finds them.

Related Tools