JSON Formatter & Validator – Beautify or Minify JSON Online

Paste JSON to format it with clean indentation, check that it is valid, minify it or sort the keys. Errors are shown with the exact line and column.

Runs in your browser 100% free No sign-up
Quick answer

Paste your JSON and click “Format / beautify”. Valid JSON is re-indented with 2 or 4 spaces or tabs; invalid JSON shows the line and column of the first error. “Minify” removes all whitespace, and “String → JSON” turns an escaped string like "{\"a\":1}" back into JSON.

How to use JSON Formatter

  1. Paste or type your JSON into the input box.
  2. Click “Format / beautify” for readable output, or “Minify” for the smallest size.
  3. Choose 2 spaces, 4 spaces or tabs, and tick “Sort keys A–Z” if you want a stable order.
  4. If there is an error, fix the line and column shown and format again.
  5. Copy the result or download it as a .json file.

What a JSON formatter does

JSON (JavaScript Object Notation) is the most common format for APIs, configuration files and data exchange. Machines send it on one long line to save space, which makes it hard for people to read. A JSON formatter (or beautifier) parses the text and prints it again with line breaks and indentation, so nested objects and arrays are easy to follow. Because the text is parsed first, formatting also validates it: if the JSON is broken, you see where.

The JSON rules that cause most errors

MistakeWrongRight
Single quotes{'a': 1}{"a": 1}
Trailing comma[1, 2, 3,][1, 2, 3]
Unquoted keys{a: 1}{"a": 1}
Comments{"a": 1 // note}not allowed in JSON
Special valuesNaN, undefinednull or a number

JSON follows the RFC 8259 standard. Strings and keys always use double quotes, numbers cannot start with a leading zero or a plus sign, and only true, false and null are allowed as literal values.

Format, minify and sort

  • Format makes JSON readable for debugging, code reviews and documentation.
  • Minify removes every unnecessary space and line break — useful for smaller payloads and config values.
  • Sort keys orders object keys alphabetically at every level, which makes two JSON files easy to compare with a diff tool.

From escaped string to JSON

Logs and databases often store JSON inside a string, with every quote escaped: "{\"id\":5}". The String → JSON button decodes that string first and then formats the JSON inside it.

Private by design

Many online formatters send your data to their server. This one parses everything in your browser with the built-in JSON engine, so you can safely paste API responses that contain tokens, emails or customer data. Need to encode data for a URL or email? Try the Base64 Encode / Decode, and to test patterns inside text use the Regex Tester.

You may also find these free tools useful: Password Generator, Regex Tester and UUID Generator.

Frequently asked questions

How do I format JSON online?

Paste the JSON into the box and click “Format / beautify”. Choose 2 spaces, 4 spaces or tabs for the indentation, then copy or download the result.

How do I know if my JSON is valid?

Click format: valid JSON shows “✓ Valid JSON”. Invalid JSON shows an error with the line and column where parsing failed.

Why is my JSON invalid?

The most common causes are single quotes, a trailing comma after the last item, keys without quotes and comments. JSON allows none of them.

Is my data sent to a server?

No. Formatting and validation happen in your browser. Nothing you paste leaves your device.

What is the difference between formatting and minifying?

Formatting adds line breaks and indentation for humans. Minifying removes all whitespace to make the data as small as possible for machines.

Last updated: