PrettyJSON Logo
PrettyJSON

Instantly clean, validate, and inspect web payloads

Sample Payloads
Buy me a coffee
Raw JSON Input

Waiting for JSON content

Start typing on the left or load one of the sample payloads to inspect it instantly.

RFC 8259 Compliant & 100% Client-Side

JSON Validator Online — Free JSON Lint & Syntax Checker

Validate JSON syntax in real-time. Detect exact line numbers, column markers, missing quotes, and invalid syntax according to RFC 8259 specifications.

Private & Offline Ready

Every tool runs in your browser, so the JSON you paste never leaves your device.

Works Instantly, Even Offline

Formatting, minifying, repairing, and the tree view all run on your device, so there are no uploads to wait on.

Exact Error Line & Column

Syntax errors like unescaped quotes and trailing commas are flagged with their exact line and column.

How JSON Validation Works: Syntax Rules and Error Detection

What makes JSON valid, how errors are pinpointed by line and column, and the mistakes that break it most often.

1. Parsing and Where Validation Fails

Validating JSON means trying to parse it against the rules of the JSON grammar. The parser reads the text left to right, turning it into tokens — braces, brackets, colons, commas, strings, numbers, and the keywords true, false, and null — and checks that they appear in a valid order. If something is out of place, such as a comma right before a closing bracket, parsing stops at that point and reports an error. PrettyJSON validates as you type, so you see problems immediately instead of after a failed request.

Technical Highlights

  • Validation parses your text against the JSON grammar.
  • The first invalid token stops parsing and is reported.
  • PrettyJSON checks your JSON as you type.

2. Pinpointing Errors by Line and Column

A message like "Unexpected token" is not much help in a file with thousands of lines. PrettyJSON tracks the line and column as it parses, so when it hits a problem it points to the exact spot and shows the surrounding text. That turns "somewhere this JSON is broken" into "line 14, column 28: trailing comma before the closing bracket," which is usually enough to fix it in seconds.

Pinpointing a Syntax Error
Line 14, Column 28:
  "permissions": ["read", "write",]
                                 ^
Error: trailing comma before ']'. JSON does not allow a comma after the last item in an array.
Explanation: The exact line and column let you jump straight to the problem in a large payload.

3. The Mistakes That Break JSON Most Often

Most invalid JSON fails for a small set of reasons: single quotes instead of double quotes, a trailing comma after the last item, keys that are not quoted, JavaScript-style comments, and Python values like True, False, or None pasted from a log. These are easy to introduce when you copy JSON out of code or a terminal. When PrettyJSON spots one of them, it points to the location and offers a one-click repair that fixes the common cases for you.

Technical Highlights

  • Common causes: single quotes, trailing commas, unquoted keys, comments, and Python literals.
  • They usually come from copying JSON out of code or logs.
  • Detected issues link straight to the one-click repair tool.

Frequently Asked Questions

Common questions and expert answers regarding this tool.

What makes JSON valid or invalid?

Valid JSON follows a few rules: keys and string values use double quotes, no comma after the last item, no comments, and values must be a string, number, object, array, boolean, or null. Single quotes and unquoted keys are not allowed.

How does PrettyJSON find syntax errors?

It parses your JSON as you type and reports the first problem with its exact line and column, so you can jump straight to a missing brace, a trailing comma, or an unquoted key.

How is JSON different from a JavaScript object?

JavaScript objects allow single quotes, unquoted keys, comments, functions, and trailing commas. JSON is a stricter data format: double quotes around every key and string, and none of those extras.