JSON Formatter & Validator

Paste JSON to check it instantly and pretty-print it. Errors show the line, column and the most likely cause.

Features

  • Validates as you paste. Errors show the line and column, highlight the spot and explain common causes such as trailing commas, single quotes and comments
  • Pretty-print with 2 spaces, 4 spaces or tabs, or minify to one line. Keys can be sorted alphabetically
  • Fix common mistakes (comments, trailing commas, single quotes, unquoted keys, NaN …) automatically, after reviewing a list of every change
  • Integers beyond 2^53 are kept digit for digit. Numbers that JSON.parse would change, numbers above the safe integer limit, and duplicate keys are flagged
  • Collapsible tree view. Click a key to copy its JSONPath (such as $.items[3].name) or a JavaScript-style path
  • Unescape \u sequences into characters or escape non-ASCII text. Open files and download the result

Use cases

Reading API responses

Pretty-print a one-line response and find the value you need, with its path, in the tree.

Debugging config files

Turn a vague "Unexpected token" into an exact line, column and cause.

Cleaner diffs

Sort keys and format two JSON files the same way so they are easy to compare.

Checking large IDs

Make sure IDs above 2^53, such as those from social media APIs, have not been rounded.

Privacy

The JSON you enter and the files you open are processed only in your browser and never sent anywhere. Your input is not saved; only settings such as the indent are kept on this device for next time.

FAQ

How is JSON different from a JavaScript object?

JSON is a data format based on JavaScript object syntax, but stricter. Keys and strings must use double quotes, and the only values are strings, numbers, true, false, null, objects and arrays. undefined, NaN, functions and dates cannot be written.

Why are comments and trailing commas invalid?

JSON is meant for exchanging data between programs, so its grammar is kept as small as possible to read the same way in every language. Config files that need comments often use JSONC or JSON5. "Fix common mistakes" can strip comments and trailing commas for you.

What happens to big numbers (integers above 2^53)?

JavaScript numbers cannot represent integers above 2^53 − 1 (9007199254740991) exactly, so JSON.parse turns 9007199254740993 into 9007199254740992. This tool does not use JSON.parse; it keeps the digits as written and warns about numbers that would change. Some values above the limit, such as 9007199254740994, happen to be stored exactly, but arithmetic on them can still be off, so those get a milder note. In code, store such values as strings or use BigInt.

How are line and column counted?

Both start at 1. Columns count Unicode code points: a CJK character counts as one, but combined emoji (family emoji, flags) may count as several, so the number can differ from editors such as VS Code. Because JSON.parse error messages differ between browsers, this tool checks the grammar itself and points to where the error begins.

Are duplicate keys a problem?

The JSON standard does not forbid them, but most programs keep only the last value and silently drop the earlier one. Since that is usually an accident, this tool warns about it (the output keeps both).

Is my JSON sent anywhere?

No. Validation, formatting and the tree view all run in your browser, and files are never uploaded, so confidential API responses and config files are safe to paste.

Related tools

You can also drop a file onto this box. JSON is processed only inside this browser and is never sent anywhere. Files are read locally, not uploaded.

Enter JSON and it will be validated and formatted right away.

Formatted JSON

Indent

Tree view

Click a key to copy the path to that spot.

Path to the selected spot

JSONPath $
JavaScript data

Enter valid JSON to see it as a tree here.