JSON (JavaScript Object Notation) is a plain-text format for structured data: objects of key/value pairs, arrays, strings, numbers, true, false and null. It is the usual format for web APIs, configuration files and test fixtures, and its rules are strict, so one stray comma makes a whole document unreadable to a parser.
This tool checks a JSON document against those rules, tells you exactly where it breaks, and rewrites valid JSON in a readable or compact form. It runs entirely in your browser: the text you paste or the file you open is never sent to RoboQA or anyone else.
How to use
- Paste JSON into the Input box, open a file with “Upload a .json file”, or press “Load sample” to try it.
- Press Format to indent it, or Minify to remove all whitespace. Choose 2 spaces, 4 spaces or tabs, and tick “Sort keys” to order object keys alphabetically.
- If the JSON is invalid, read the message under the input: it gives the line and column, selects that spot in the input, and suggests the likely cause.
- Copy the result with “Copy output”, or save it with “Download .json”.
Features
- Format with 2 spaces, 4 spaces or tabs, or minify to a single line.
- Strict validation that follows the JSON standard (RFC 8259), with the line and column of the first error.
- Hints for common mistakes such as trailing commas, single quotes, unquoted keys and comments. Your text is never changed automatically.
- Optional recursive key sorting; arrays keep their order.
- Large numbers are kept exactly as written, with a warning when JavaScript would round them.
- String escapes are kept as you wrote them, so \u00e9 stays \u00e9.
- A collapsible tree view, and the size in bytes before and after.
Common uses
- Debugging API responses. Paste a response body from your browser's network tab, curl or Postman to see its structure or spot why a client fails to parse it.
- Validating config files. Check package.json or app settings before you commit, and get the exact line of a broken edit.
- Minifying for production. Strip whitespace from JSON you ship in a bundle, a request body or a fixture, and see how many bytes you saved.
- Preparing test data for QA. Sort the keys of payloads and expected responses so fixtures are easy to review and diff, and make sure every fixture is valid before a test run depends on it.
Frequently asked questions
What makes JSON invalid?
The most common causes are a comma after the last item in an object or array, strings or keys in single quotes, keys without quotes, comments, and a missing closing bracket or brace. JSON also has no undefined, NaN or Infinity, numbers cannot have leading zeros or a trailing decimal point, and a line break inside a string must be written as \n.
What is the difference between JSON and a JavaScript object?
JSON is a text format with a fixed grammar; a JavaScript object literal is code. JavaScript accepts unquoted keys, single quotes, trailing commas, comments, functions and undefined; JSON accepts none of them, and every key must be a double-quoted string.
Is my data uploaded anywhere?
No. Formatting, validation and file reading all happen in your browser with JavaScript on this page. The tool makes no network requests while you use it, and your input is not stored, not even in your browser's local storage, so it is gone when you close the tab.
Can it handle large files?
Yes, up to 5 MB per file. Above 1 MB it validates when you press a button instead of on every keystroke, so typing stays responsive.
Why do trailing commas fail?
The JSON grammar only allows a comma between two values, so a comma right before a closing ] or } is a syntax error, even though JavaScript accepts it. Remove the comma after the last item.
How do I fix “Unexpected token”?
That message, from JavaScript's JSON.parse, means the parser met a character it did not expect at that point. At the position the tool reports, a ' usually means single quotes, a letter an unquoted key or a word like undefined, a / a comment, and an unexpected end a missing bracket or quote. An error at the very start often means the text isn't JSON at all, such as an HTML error page.
Why do other tools change my large numbers?
JavaScript stores numbers as 64-bit floating point, which holds integers exactly only up to 9,007,199,254,740,991 (2^53 − 1), so JSON.parse rounds larger IDs. This tool keeps the digits as you typed them and warns you, because the program reading the JSON may still round them; sending such IDs as strings avoids the problem.
Related tools
- URL Encoder & Decoder — Percent-encode or decode text and URLs in your browser, with clear errors for malformed input and a URL parser.
Need to test a whole website, not just a snippet?
RoboQA tests real pages and user journeys in a browser: logins, forms, clicks and full flows. See what RoboQA can test or compare plans.