How this tool works
Uses the browser JSON parser and serializer, reporting a syntax error or producing formatted JSON.
How to use it
- Paste JSON text.
- Choose pretty-print or minify and key ordering.
- Review the output and validate it against your application schema separately.
Limits to keep in mind
Valid syntax does not guarantee that data matches an API schema or is semantically correct. Large inputs may use browser memory.
Frequently asked questions
Does it validate an API schema?
No. It checks JSON syntax only.
Is key order meaningful in JSON?
Object order is not generally a semantic requirement; sorting is an optional readability choice.
Why do I get a syntax error on JSON that looks fine?
Common causes are trailing commas, single quotes instead of double quotes, unquoted keys and comments. Standard JSON allows none of these.
Is it safe to paste sensitive data?
Parsing happens in your browser and nothing is uploaded by the tool. Even so, avoid pasting live secrets, passwords or tokens into any web page.
Formatting and syntax validation
JSON is a text format for data, used by APIs, configuration files, logs and many web applications. It is easy for software to read, but a single missing comma or quote can make a whole document invalid, and minified JSON on one long line is very hard to read. The JSON Formatter and Validator helps with both problems.
The tool uses your browser's own JSON parser. When you paste text, it tries to read it as JSON. If the text is valid, it can display it with clear indentation, or compress it into a compact form. If the text is not valid, it reports a syntax error so you can find the problem. Because it uses the browser's parser, the rules match what JavaScript applications expect, and the error messages come from the browser, so their wording can differ between browsers.
Common syntax errors
Most invalid JSON fails for a small set of reasons. The most common is a trailing comma after the last item in an object or list. Another is the use of single quotes, since JSON requires double quotes around strings and around property names. Keys without quotes, comments, and values such as undefined or NaN are also not allowed in standard JSON.
Other frequent problems are missing commas between items, unclosed brackets or braces, unescaped quotes inside strings, and stray text before or after the document. Copying JSON from a document or chat tool can add curly quotation marks or hidden characters that look right but break parsing. When you see an error, look at the position it mentions and check the characters just before it, since the real mistake is often a little earlier.
Pretty-print or minify
Pretty-printing adds line breaks and indentation so you can follow the structure of objects and lists. It is the best choice when you are reading, debugging or comparing data, and when you are writing configuration that people will edit.
Minifying removes the extra whitespace to create the smallest text for the same data. It is useful when you want to send JSON over a network, store it in a limited space, or paste it into a single-line field. Both forms contain exactly the same data, and you can switch between them at any time. The difference is only in how the text looks, not in what it means.
Optional key sorting
The tool can sort the keys of objects in order. In the JSON specification, the order of keys in an object has no meaning, so sorting does not change the data. It does make documents easier to compare, since two objects with the same content will appear in the same order, and differences stand out in a comparison tool or version control.
Be careful if your application depends on the order of keys, which some software does by accident, and remember that lists are different. The order of items in an array does matter, and the tool does not reorder them. If you plan to replace a configuration file with a sorted version, test it first to make sure the application still behaves the same way.
Syntax is not schema or business validation
A document can be valid JSON and still be wrong for your purpose. Valid syntax means the text follows the JSON rules. It does not mean that the right fields are present, that values have the right types, that numbers fall in an allowed range, or that the data matches what an API expects.
To check structure and content, use JSON Schema or the validation tools of the system you are working with, and test against the real API or application. This tool answers one question only: can this text be read as JSON? That is still an important question, because it catches the typing mistakes that cause many integration problems, and it should be answered before you look for deeper issues.
Large numbers, duplicates and precision
There are some subtle points to know. The browser's parser reads numbers as floating-point values, so very large integers, such as long identifiers above about nine quadrillion, can lose precision when they are parsed and written back. If your data has long numeric IDs, check that they are unchanged, or store them as strings.
If an object contains the same key twice, the parser accepts it without complaint and keeps the last value, so the formatted output may silently drop the earlier one. If you suspect duplicate keys, review the original text. Also remember that special JavaScript values and comments are not part of standard JSON. Formats that allow them, such as JSON5 or JSONC, need a different tool.
Work with large or sensitive files
Parsing happens in your browser and the tool does not upload your data. Very large documents use memory, so a file of many megabytes may make the page slow or fail. For big files, work with a smaller sample, or use a command-line tool or your editor.
Be careful with what you paste into any web page. JSON often contains personal data, access tokens, passwords, API keys or internal URLs. Remove or replace sensitive values with dummy ones before using an online tool, and never share a snippet that includes live credentials. If the data is confidential or regulated, use tools inside your own environment that your organization has approved.
More HTML & Developer Tools · Browse the tools catalogue