Skip to content
WebUtilityHub

JSON Formatter & Validator

Paste JSON to pretty-print it, minify it or find exactly where it is broken. Validation is built in, and nothing you paste leaves your browser.

Output

Paste JSON to format and validate it.

    How to use the JSON Formatter

    1. Paste your JSON into “Your JSON”, or click “Load example” to try the tool.
    2. Choose the output style — 2 spaces, 4 spaces, tabs or minified. The result updates as you type.
    3. If the JSON is invalid, read the message under the editors and click “Show error in input” to jump to the problem.
    4. Copy the result, or download it as a .json file.

    Examples

    Pretty-print minified JSON
    Input
    {"name":"Ada","skills":["math","code"],"active":true}
    Result
    {
      "name": "Ada",
      "skills": [
        "math",
        "code"
      ],
      "active": true
    }
    A trailing comma
    Input
    {"a": 1, "b": 2,}
    Result
    Invalid JSON: line 1, column 16
    Trailing comma before "}" is not allowed in JSON.
    Large numbers are kept exactly
    Input
    {"id": 12345678901234567890, "price": 1.10}
    Result
    {"id":12345678901234567890,"price":1.10}
    Minified output. Many online formatters would change the id to 12345678901234567000 and the price to 1.1.

    Reading the error messages

    Each message names the problem and where it is. Common ones:

    • Trailing comma — a comma after the last item in an object or array, such as {"a": 1,}. Remove it.
    • Is a comma missing? — two values next to each other without a comma, often after editing a line by hand.
    • Property names must use double quotes — JSON requires "key", not 'key' or key.
    • JSON literals are lowercase — True, False and None come from Python; JSON uses true, false and null.
    • Unexpected … after the end of the JSON value — the input contains two documents, or extra text after the closing bracket. Wrap several values in an array.

    Columns are counted in characters as you see them, so an emoji counts as one column. “Show error in input” selects the character where the problem was found.

    Indentation and minification

    Two-space indentation is the most common style for JSON files and APIs. Four spaces or tabs may match your project’s editor settings. Minified JSON removes every optional space and line break, which makes it smaller to send and store but harder to read.

    JSON often arrives wrapped in another encoding. Decode a Base64 payload with the Base64 decoder, or a JSON value taken from a query string with the URL decoder, then paste the result here. Need IDs for test data? The UUID Generator creates as many as you need.

    Common uses

    • Reading API responses, log entries and configuration files that arrive on one line.
    • Finding the exact cause of a “Unexpected token” error before deploying a config change.
    • Minifying JSON to paste into an environment variable, a query string or a test fixture.
    • Checking JSON written by hand, such as package.json or translation files.
    • Spotting duplicate keys that silently overwrite each other in most parsers.

    Limitations

    • Only standard JSON is accepted. JSON5, JSONC, comments, single quotes and trailing commas are reported as errors, because most programs reject them too.
    • The formatter does not sort keys or change values; it only changes whitespace.
    • Nesting deeper than 500 levels is rejected to keep the page responsive.
    • Very large documents (tens of megabytes) may be slow to paste and display on phones.

    Frequently asked questions

    Is this also a JSON validator?

    Yes. Every time the input changes it is checked against the JSON standard (RFC 8259). Valid JSON shows a green “Valid JSON” message with the number of keys and the nesting depth; invalid JSON shows the line, the column and a plain-English description of the problem.

    Why doesn't the formatter change my numbers?

    Many formatters run your data through JavaScript's JSON.parse, which stores numbers as 64-bit floating point. Integers above 9,007,199,254,740,991 lose precision and values like 1.10 become 1.1. This tool reads numbers as text, so they are printed exactly as you wrote them.

    What happens with duplicate keys?

    JSON technically allows them, but most programs silently keep only the last value. The formatter keeps both entries in the output and lists every duplicate with its location, so you can decide which one to keep.

    Why are comments and trailing commas errors?

    They are not part of the JSON standard. Some tools accept them (JSON5, JSONC, VS Code settings), but APIs and most parsers do not, so the formatter flags them to help you produce JSON that works everywhere.

    Can I format JSON that contains sensitive data?

    The formatting happens in your browser and nothing is sent to a server. That said, follow your organisation's rules for handling secrets, and close the page when you are done.

    Percent-encode or decode URLs, query parameters and form data, with full UTF-8 support.

    Developer

    Generate one or many random UUID v4 values using your browser’s cryptographically secure generator.

    Developer