Tools › Build › JSON Formatter & Validator
{ }

JSON Formatter & Validator

Paste messy or minified JSON to format, validate, minify and explore it as a collapsible tree — with exact error locations, all in your browser.

🔒 100% Private
📍 Exact error line & column
🌳 Tree view
✨ Auto-fix mistakes

Input

1 line • 0 charactersLn 1, Col 1

Output

Click a key to copy its path
1 line • 0 characters
Advertisement

How to use

  1. Paste your JSON into the Input box, or use Open file to load a .json file. It is checked and formatted as you type.
  2. If the JSON is valid you get a clean, indented result and a summary of keys, objects, arrays, depth and size. If it is not, you get the exact line and column and a plain-English reason.
  3. Choose 2 spaces, 4 spaces or Tab, tick Sort keys A–Z for a stable key order, or press Minify to remove all whitespace.
  4. Switch the output to Tree to expand and collapse nested data, and click any key to copy its path (for example $.user.address.city).
  5. Turn on Auto-fix mistakes to repair trailing commas, comments, single quotes, unquoted keys and Python-style True / False / None. Then Copy or Download the result.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight text format for storing and exchanging data. It is the standard format for web APIs, configuration files, logs and databases such as MongoDB and PostgreSQL. It is built from just a few pieces: objects { } with named keys, arrays [ ], strings in double quotes, numbers, true, false and null.

Everything is checked in your browser. Your data is never uploaded, which makes this safe for API responses, configuration and other work data.

Common JSON errors and how to fix them

Trailing comma — a comma after the last item, such as {"a":1,}. Single quotes — JSON requires double quotes, so 'a' is invalid. Unquoted keys — write {"a":1}, not {a:1}. Comments — // and /* */ are not allowed. Missing comma between two items. Unescaped line break inside a string — use \n. Python values such as True, False and None must be true, false and null.

The error message shows the line, column and a pointer to the problem. Press Auto-fix & format to repair the common ones automatically; your original input is not changed.

Formatting without changing your data

Many formatters parse the data into JavaScript objects first, which silently changes it: numbers longer than 15 digits are rounded, 1.50 becomes 1.5, integer-like keys are re-ordered and duplicate keys disappear. This tool reads the text directly, so numbers, string escapes and key order are kept exactly as you wrote them, and duplicate keys are reported instead of being dropped. Turn on Sort keys only when you want the order changed.

Frequently asked questions

How do I format JSON online?

Paste your JSON into the Input box. The formatted, indented result appears on the right as you type. Choose 2 spaces, 4 spaces or tab indentation, then copy the result or download it as a file.

How do I validate JSON?

Validation runs automatically. A green banner means the JSON is valid and shows its size and structure. A red banner shows the line and column of the first error, the reason, and the offending line with a pointer. Click Go to error to jump to it in the input.

Is my JSON uploaded to a server?

No. Parsing, formatting and the tree view all run in your browser. Your JSON is never sent anywhere or stored, so it is safe to use with API responses and configuration files.

How do I minify JSON?

Press Minify. All whitespace outside strings is removed, which reduces the size for APIs, storage and URLs. The status bar shows how much smaller it became.

Why does my JSON show an error when it works in JavaScript?

JavaScript object literals are more relaxed than JSON. They allow single quotes, unquoted keys, trailing commas and comments, while JSON allows none of these. Turn on Auto-fix mistakes to convert such text into valid JSON.

Does it keep large numbers and decimals exactly?

Yes. Numbers are copied as written, so 12345678901234567890 and 1.50 stay unchanged. Tools based on JSON.parse would round the first to 12345678901234567000 and turn the second into 1.5.

What does Sort keys do?

It sorts object keys alphabetically at every level, which makes two JSON files easier to compare. Arrays keep their order. Sorting is optional and only affects the output, not your input.

How large a file can it handle?

Files of several megabytes work fine. For very large input (over about 1.5 MB), syntax colouring is switched off to keep the page responsive; the formatting itself is unaffected. The tree view loads branches only when you open them.

What is the difference between JSON and a JavaScript object?

JSON is a text format. Keys must be in double quotes, strings must use double quotes, and it cannot hold functions, comments, undefined or trailing commas. A JavaScript object is an in-memory value that you can convert to and from JSON with JSON.stringify() and JSON.parse().