TC

JSON Formatter & Validator

Paste your JSON to instantly format, validate, and beautify it. Invalid JSON is pinpointed with the exact line and column. Everything runs locally — nothing is uploaded.

JSON Specification

JSON (JavaScript Object Notation) is a lightweight, language-independent data-interchange format. This page is a plain-language reference for its syntax, based on RFC 8259 and ECMA-404.

JSON value types

Object

An unordered set of "key": value pairs, wrapped in curly braces. Keys must be strings; values can be any JSON type.

Array

An ordered list of values, wrapped in square brackets and separated by commas. Values can be of mixed types.

String

Zero or more Unicode characters wrapped in double quotes. Backslash starts an escape sequence — single quotes are not valid.

Number

An integer or floating-point number. No leading zeros, no NaN/Infinity, and no hexadecimal notation.

Boolean

One of exactly two literal values, always lowercase.

Null

Represents an empty or absent value. Lowercase, and distinct from an empty string or zero.

Syntax rules

  • Object keys must always be strings, wrapped in double quotes — unquoted or single-quoted keys are invalid.
  • Trailing commas after the last item in an object or array are not allowed.
  • Comments (// like this or /* like this */) are not part of the JSON spec and will fail to parse.
  • Whitespace (spaces, tabs, newlines) is allowed between tokens but never required — it's purely cosmetic.
  • A valid JSON document has exactly one root value: an object, array, string, number, boolean, or null.
  • Numbers cannot have leading zeros (01 is invalid), leading +, or trailing decimal points.

String escape sequences

\"Double quote
\\Backslash
\/Forward slash (optional)
\bBackspace
\fForm feed
\nNewline
\rCarriage return
\tTab
\uXXXXUnicode code point (4 hex digits)

How it works

1

Paste or upload

Paste JSON directly, or drag & drop / upload a .json file.

2

Format & validate

Choose your indentation, optionally sort keys, and click Format. Errors show the exact line and column.

3

Copy or download

Copy the formatted result to your clipboard or download it as a .json file.

Frequently Asked Questions

Common questions about formatting and validating JSON.

No. All parsing, validation, and formatting happen locally in your browser using JavaScript's native JSON engine. Nothing is uploaded or stored.

Common causes are trailing commas, single quotes instead of double quotes, unquoted keys, or a missing comma/bracket. The error message shows the exact line and column where parsing failed.

It alphabetically reorders every object's keys, recursively, which makes it easier to diff or compare two JSON documents.

Format pretty-prints the JSON with your chosen indentation for readability. Minify strips all whitespace to produce the smallest possible output, useful for production payloads.

There is no hard limit, but extremely large files (tens of MB) may be slow since parsing happens in your browser's main thread.

It repairs the most common real-world mistakes: // and /* */ comments, single or "smart" quotes, unquoted keys, trailing or duplicated commas, missing commas or colons between entries, unclosed braces/brackets from an incomplete paste, JavaScript-only values like NaN/Infinity/undefined, and multiple objects with no enclosing array. It then re-validates the result. It's a best-effort heuristic, not a full parser, so unusually malformed input may still need manual fixes.