Skip to content
ToolFarmToolFarm
DeveloperPopular

JSON Formatter

Format, validate and minify JSON in your browser.

2 min read

What this tool does

JSON formatter that beautifies, validates or minifies any JSON inside your own browser. Paste the content, choose the action and the output appears formatted, without sending anything to a server.

If you're debugging an API, you'll also want regex tester for field extraction and Base64 encoder to crack JWT payloads.

What you can use it for

  • Beautify a minified JSON returned by an API to read it more easily.
  • Minify a JSON before pasting it into a configuration file.
  • Spot syntax errors when an endpoint returns something odd.
  • Sort the keys of a JSON to review it through a diff.

How to use it

  1. Paste the JSON into the input area.
  2. Pick the action: beautify, minify or just validate.
  3. If you beautify, pick the indent (2 spaces, 4 spaces or tab).
  4. Toggle the sort-keys option if you want the result alphabetized.

Everything runs inside your browser. No file is uploaded to any server. See more tools in this field.

Most common JSON errors

When validation fails, it's almost always one of these reasons. Learning to read them saves a lot of round-trips.

  1. 01

    Unexpected token } in JSON at position N

    Cause

    There's a trailing comma before the object's closing brace.

    How to fix it

    Remove the last comma. JSON does not allow trailing commas, unlike JavaScript.

  2. 02

    Unexpected token " in JSON at position N

    Cause

    A key or value starts with quotes that aren't closed or are duplicated.

    How to fix it

    Check every string starts and ends with the same double quote. JSON does not allow single quotes.

  3. 03

    Unexpected end of JSON input

    Cause

    A missing closing object, array or string.

    How to fix it

    Count opened and closed braces. Usually a } or ] is missing at the end.

  4. 04

    Unexpected token N in JSON at position N

    Cause

    A key is not wrapped in quotes.

    How to fix it

    JSON requires double quotes around keys too. Wrap every key in double quotes.

  5. 05

    Bad escaped character in string

    Cause

    There's a backslash inside a string that doesn't introduce a valid escape.

    How to fix it

    Escape backslashes by doubling them (\\) or use regular characters. Only \", \\, \/, \b, \f, \n, \r, \t and \uXXXX are valid.

Other tools people reach for in the same flow.

Developer

Frequently asked questions

What does beautify do exactly?

It reformats the JSON with line breaks and indentation so it's readable. It does not change values or key order unless you turn on the sort option.

And minify?

It strips every unnecessary space, tab and line break. The resulting JSON takes the minimum size possible while preserving the same meaning.

What happens if the JSON has an error?

The validator shows the exact position of the error (line and column) and a description of what was expected. It's usually a trailing comma, an unclosed quote or a key without a value.

Does it support JSON with comments or JSON5?

Standard JSON does not allow comments. If you paste JSON5 with comments and trailing commas, validation will fail. Remove them first or use a specific tool for that format.