Skip to content
SPCXTools

JSON Formatter & Validator

Beautify, minify and validate JSON instantly, with clear error locations.

Runs locally — files never leave your device

Loading tool…

How to use JSON Formatter & Validator

  1. 1Paste your JSON into the Input box, or click Load sample to try it.
  2. 2Choose Beautify to pretty-print with 2 spaces, 4 spaces or tabs, or Minify to remove all whitespace.
  3. 3Tick Sort keys if you want object keys ordered alphabetically at every level.
  4. 4If the JSON is invalid, read the error message — it shows the line and column where parsing stopped.
  5. 5Copy the result or download it as a .json file.

Format and validate JSON in your browser

This JSON formatter turns compact or messy JSON into clean, indented text that is easy to read — and tells you immediately if the JSON is not valid. It is also a JSON minifier: switch to minify mode to strip all whitespace for production use. Everything happens locally in your browser, so you can safely work with API responses, tokens, logs and configuration files without uploading them anywhere.

Output updates as you type or paste. There is no "submit" button and no waiting for a server.

Features

  • Beautify / pretty print with a choice of 2 spaces, 4 spaces or tab indentation.
  • Minify to produce the smallest possible single-line JSON.
  • Validation with error location. If parsing fails, the message shows the line and column, so you can jump straight to the missing comma or stray quote.
  • Sort keys alphabetically at every level of nesting for consistent, comparable output.
  • Copy or download the result as a .json file.

Common uses

Debugging APIs. Responses from REST APIs and webhooks often arrive as one long line. Paste the response here to see its structure, find the field you need and check its type.

Editing configuration. Many tools store settings as JSON (package.json, tsconfig.json, VS Code settings, cloud templates). Validate your edits before saving to avoid a broken deployment.

Preparing payloads. Minify JSON before sending it in a request body, putting it in an environment variable or embedding it in HTML.

Comparing documents. Sort keys in two JSON documents, then compare them with the Diff Checker to see what really changed.

JSON syntax rules in brief

JSON (JavaScript Object Notation) is a strict subset of JavaScript object syntax:

  • Strings and object keys must use double quotes: "name", not 'name' or name.
  • No trailing commas after the last item in an object or array.
  • No comments. // and /* */ are not allowed.
  • Allowed values are strings, numbers, true, false, null, objects and arrays. undefined, NaN, Infinity and dates are not JSON values — dates are usually stored as ISO strings like "2026-10-02T12:00:00Z".
  • Special characters in strings, such as quotes, backslashes and line breaks, must be escaped (\", \\, \n).

If you receive data that is encoded as Base64 or comes inside a token, decode it first with the Base64 tool or the JWT Decoder, then format it here.

Frequently asked questions

Is my JSON sent to a server?
No. Parsing and formatting use your browser's built-in JSON engine. The data never leaves your device, so it is safe to paste API responses, configuration files or data containing personal information.
Why does the validator say my JSON is invalid?
The most common causes are trailing commas after the last item, single quotes instead of double quotes, unquoted keys, comments, and values such as undefined or NaN. These are allowed in JavaScript but not in strict JSON. The error message tells you where the parser stopped, which is usually at or just after the mistake.
Does sorting keys change my data?
Sorting only changes the order of keys inside objects. Values and array order stay exactly the same. Sorted output is useful for comparing two JSON documents or keeping config files tidy in version control.
What is the difference between beautify and minify?
Beautify adds line breaks and indentation so people can read the structure. Minify removes every unnecessary space and line break to make the payload as small as possible, which is what you want for network requests or embedding JSON in code.
Can it handle large JSON files?
Yes. Files of several megabytes format instantly on a typical computer. Extremely large files (hundreds of megabytes) are limited only by your browser's memory.
Are big numbers preserved exactly?
JSON numbers are converted to JavaScript numbers, which are precise up to 2^53 (about 9 quadrillion). Integers larger than that, such as some database IDs, may lose precision. If that matters, store such IDs as strings.