Skip to content

How to Use JSON Formatter & Validator

Format and validate JSON online with 2-space, 4-space or tab indentation. Sort object keys, minify JSON and copy the result for free.

About this tool

Beautify, minify and validate JSON with helpful error messages.

How to use JSON Formatter & Validator

  1. Paste JSON into JSON input. Valid input is formatted automatically; invalid input shows a parsing error below the editor.
  2. Choose 2 spaces, 4 spaces or Tabs. Enable Sort keys if you want object properties sorted, including nested objects.
  3. Click Beautify for readable output or Minify for compact JSON, then copy or download the result using the output controls.

Worked example

Try {"name":"Ada","active":true,"roles":["editor"]}. Beautify adds indentation and line breaks; Minify removes that formatting. Neither mode translates property names or checks your application schema.

Sort JSON keys before comparing files

Enable Sort keys and use the same indentation for both inputs. Object keys are sorted recursively, while array order remains unchanged. This reduces differences caused by object key order, but it is not a canonical JSON serializer for digital signatures.

Syntax validity versus API requirements

Valid JSON can still be rejected by an API if required fields or data types are wrong. Formatting makes the structure readable; it does not verify an application-specific schema.

Common JSON errors

Use double quotes for names and strings, remove trailing commas and JavaScript comments, and check matching brackets. Inspect text near the parser’s reported error position.

Check numeric precision and duplicate keys

Very large integers may lose precision when parsed in JavaScript. Duplicate keys may be overwritten by a parser. Check data meaning as well as syntax before copying the result.

Why is my JSON invalid?

JSON requires double-quoted property names and strings. Comments, trailing commas and single-quoted strings are not accepted. Review the reported error and fix the input before formatting.

Does formatting preserve every number exactly?

The formatter uses JavaScript JSON parsing. Integers outside the safe integer range can lose precision, and duplicate object keys keep only the last value. Represent large identifiers as strings and retain your original input.

Is my JSON sent to a server?

Formatting and validation run in your browser. The formatter does not submit the JSON input to a server.

Text processing on your device

Formatting and parsing run in your browser. The JSON input is not uploaded by this tool.

Put this guide into practice

Explore Coding Tools · More practical guides

Accessibility Menu

Personalize your experience. Open with Ctrl+U (Option+U on Mac). Preferences stay in this browser when storage is available.

Move / Hide Widget

Restore at any time with Ctrl+U (Option+U on Mac).

Accessibility statement and help