JSON Formatter

Format, beautify and validate JSON with clear error messages.

Input

Output

Valid JSON.

About JSON Formatter

JSON is easy for machines to read but painful for humans when it arrives minified on a single line. This formatter re-indents your JSON so nesting, arrays and object boundaries become obvious at a glance.

Formatting also acts as a syntax check: if the document cannot be parsed you get the exact position of the problem instead of a generic failure. Use Minify when you need the smallest possible payload for an API request or a config value.

How to use JSON Formatter

  1. 1Paste or paste your JSON into the text area
  2. 2If your JSON is valid, it will be formatted and prettified automatically
  3. 3If there are syntax errors, the exact position and nature of the error will be highlighted
  4. 4Use the Minify toggle to compress the JSON into a single line for smaller payloads
  5. 5Copy the formatted result and use it in your application

Example

Minified API Response

Input

{"user":{"id":123,"name":"John","email":"john@example.com"},"status":"active"}

Output

{
  "user": {
    "id": 123,
    "name": "John",
    "email": "john@example.com"
  },
  "status": "active"
}

When to use JSON Formatter

  • Formatting JSON API responses for readability during debugging
  • Validating JSON configuration files before deploying
  • Minifying JSON payloads to reduce API request size
  • Identifying syntax errors in manually-edited JSON
  • Converting minified logs into readable format for analysis

Common errors & troubleshooting

SyntaxError: Unexpected token ' in JSON at position 0

JSON only supports double quotes, not single quotes. Change 'key': 'value' to "key": "value"

SyntaxError: Unexpected token , in JSON at position 42

Remove trailing commas. JSON does not allow a comma after the last item in an object or array.

SyntaxError: Unexpected token u in JSON at position 0 (when parsing undefined)

JSON does not support undefined. Replace undefined with null if you need to represent an empty value.

Limitations & details

  • Maximum input size depends on your browser's memory, but typically handles files up to several MB
  • Comments are not part of the JSON spec and will cause validation errors
  • Duplicate keys in objects are allowed by JSON spec but often indicate a data error

Frequently asked questions

Related guides

Related tools

JSON Validator

Formatters

Check whether a JSON document is valid and locate syntax errors.

Open Tool

SQL Formatter

Formatters

Format and minify SQL queries for several dialects.

Open Tool

JSON to YAML

Converters

Convert JSON documents into readable YAML.

Open Tool

YAML to JSON

Converters

Parse YAML and convert it into formatted JSON.

Open Tool