Dev Tools
All tools

JSON Formatter & Validator

Pretty-print JSON, minify it to one line, and validate the syntax. You can also sort keys alphabetically.

100% in-browser
Indent

Working with API responses or config files, you often need to expand minified JSON so a human can read it — or do the opposite and strip every space to shrink it. This JSON Formatter & Validator handles indentation, minification, and a validity check that tells you where the syntax broke, all in one place.

Beautify reads the structure with the standard JSON.parse and re-emits it at your chosen indent width, so even a messily-indented response comes out consistent. Minify removes all whitespace and line breaks for the shortest possible form, and turning on Sort Keys recursively orders every object's keys alphabetically so two JSON blobs are easy to compare. Formatting only tidies the layout — it never changes your values or data.

This tool never sends your JSON to a server; it parses it directly in your browser's JavaScript engine. Data you can't send out — internal API responses, configs containing auth tokens — is safe to paste and clean up here. The result is shown in a monospace font with a one-click copy button.

How to Use

  1. 1

    Paste JSON

    Paste the JSON string you want to clean up or check into the input box. Objects, arrays, and nested structures are all supported.

  2. 2

    Choose options

    Pick a 2- or 4-space indent, and check 'Sort keys' if you want object keys ordered alphabetically.

  3. 3

    Run an action

    Use 'Pretty' to expand it, 'Minify' to collapse it to one line, or 'Validate' to quickly check for syntax errors.

  4. 4

    Copy the result

    Hit the copy button on the result to grab it to your clipboard. If there's a syntax error, a message shows where it occurred.

When It's Useful

Read a minified API response

Beautify a one-line response to grasp the nested structure and field values at a glance.

Catch JSON syntax errors

When a config won't load, paste it and validate to locate a missing quote or trailing comma.

Normalize before diffing two JSONs

Match two objects with sorted keys and identical indentation to remove diff noise caused by ordering.

Build a one-line config value

Minify JSON into a whitespace-free form to drop into an environment variable or single-line setting.

Tips

  • Sort Keys is handy before diffing two JSON blobs — it unifies key order so only real differences show.
  • Minified JSON is convenient as an environment variable or a single-line config value.
  • The position in a validation message points to the character index of the error. Suspect a missing quote or trailing comma first.
  • JSON5 or JSONC with comments isn't standard JSON and will fail to parse. Remove comments before using it.
  • Keys must use double quotes. Single-quoted or unquoted keys are JavaScript object literals, not valid JSON.
  • Pretty/Minify parse with JSON.parse and re-emit, so beyond whitespace, number notation (e.g. 1.0 → 1) may be normalized.

FAQ

Is my JSON sent to a server?

No. Parsing, formatting, minifying, and validation all happen only in your browser; data never leaves your device.

Why does validation report an error?

Missing double quotes on keys or strings, a trailing comma after the last item, or single quotes all violate standard JSON syntax. Use the indicated position to fix it.

How does key sorting work?

It recursively sorts every object's keys alphabetically (by Unicode code point). Array order is preserved.

Can it handle very large JSON?

Multi-megabyte JSON usually processes instantly. Very large files may vary in speed depending on browser memory.

Do Korean characters or emoji break?

No. It uses standard JavaScript JSON handling, so Unicode characters like Korean and emoji are preserved exactly.

Does it support JSON5 or JSONC with comments?

No. This tool handles standard JSON only. // or /* */ comments, unquoted keys, and trailing commas will fail to parse, so clean them up first.

Does formatting change my data?

Values and structure stay intact and only indentation changes. Note that number normalization (1.0 shown as 1) or key reordering (with Sort Keys) can occur.

Validation says 'Unexpected token' — what does that mean?

Parsing stopped at an unexpected character — usually an unclosed bracket or quote, or a stray comma. Check around the position the message points to.

Related Tools