JSON Formatter & Validator

Paste JSON to format, validate or minify it. Everything runs in your browser; nothing you paste is uploaded.

Files up to 5 MB are read on your device and never uploaded.

Output

Paste JSON or load the sample to start.

    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

    1. Paste JSON into the Input box, open a file with “Upload a .json file”, or press “Load sample” to try it.
    2. 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.
    3. 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.
    4. Copy the result with “Copy output”, or save it with “Download .json”.

    Features

    Common uses

    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

    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.