Skip to content
DevToolsCave

    This tool runs entirely in your browser. Nothing you paste is uploaded.

    How you can check →
    JSON

    JSON Formatter & Validator

    Format, minify and validate JSON in your browser. Unlike tools built on JSON.parse, this one keeps your original digits, keeps duplicate keys, and tells you exactly which line is wrong.

    Result
    Formatted JSON appears here.

    What this tool does differently

    Almost every online JSON formatter is a thin wrapper around the browser's built-in JSON.parse and JSON.stringify. That is fast to build and wrong in three specific ways that matter on real data.

    It will not change your numbers

    JavaScript keeps every number as a 64-bit float. Integers above 9,007,199,254,740,991 cannot be stored exactly, so JSON.parse rounds them — paste {"id": 12345678901234567890} into most formatters, copy the pretty output back, and the identifier has changed. Twitter and Discord snowflake IDs, Postgres bigint primary keys, and high-precision decimal amounts all cross that boundary routinely. This tool parses numbers as text, re-emits exactly the digits you gave it, and flags the ones a normal parser would corrupt.

    It will not hide duplicate keys

    {"role": "user", "role": "admin"} is syntactically valid JSON, and RFC 8259 explicitly leaves the outcome undefined. JavaScript keeps the last value; several other implementations keep the first. That means a document with a duplicated property can behave differently in your API gateway than in your service — a genuine bug that a validator reporting a cheerful "valid" will never show you. This tool keeps both, marks them, and lets you decide which survives.

    Its errors point at the problem

    A built-in parse failure reads Unexpected token } in JSON at position 42, which is a byte offset into text you are looking at in lines and columns. This tool reports the line, the column, an excerpt with a caret under the offending character, and — for an unclosed bracket — where the thing that was never closed was opened.

    Common uses

    • Making an API response readable before hunting through it for one field
    • Checking that a config file is valid before a deploy fails on it
    • Minifying a payload to see how much of a size budget it takes
    • Finding which line of a webhook body a parser is rejecting
    • Copying the JSON Pointer for a deeply nested field, from the tree view
    • Sorting keys so two versions of a config can be compared line by line

    Formatting options

    Indent sets two spaces, four spaces, or tabs. Minify strips every optional byte for transport. Sort keys orders properties recursively by UTF-16 code unit — the same order RFC 8785 canonicalisation uses, and deliberately not a locale-aware sort, which would put the same document in different orders on different machines. Duplicate keys chooses whether to keep both occurrences, only the first, or only the last.

    JSON with comments

    Files such as tsconfig.json, .eslintrc and VS Code settings use JSONC: ordinary JSON plus // comments and trailing commas. Strict parsers reject them. This tool reads them, says clearly that the document is not strict JSON, and produces valid strict JSON on output — trailing commas removed, comments dropped, because the format has nowhere to keep them.

    Frequently asked questions

    Is my JSON uploaded anywhere?
    No. Parsing, formatting and validation all run in your browser using this page's own JavaScript. Nothing is sent to a server, nothing is logged, and the tool keeps working if you go offline after the page loads.
    Why does it warn about large numbers?
    JavaScript stores every JSON number as a 64-bit float, which can hold integers up to 9,007,199,254,740,991 exactly. Beyond that, digits change: 12345678901234567890 reads back as a different number. Snowflake IDs and bigint database keys cross that line routinely, so this tool keeps your original digits and warns you rather than quietly rewriting them.
    What does the duplicate key warning mean?
    Your document has the same property name twice in one object. The JSON standard does not say which one wins, so parsers disagree — JavaScript keeps the last, several other implementations keep the first. It is almost always a bug in whatever produced the document. This tool shows both and lets you choose which to keep.
    Can it handle comments and trailing commas?
    Yes. Files like tsconfig.json and .eslintrc use JSONC, which allows both. This tool parses them, tells you the document is not strict JSON, and formatting removes the trailing commas. Comments are dropped on output, because JSON has nowhere to put them.
    Why did my key order change?
    It should not have. This tool preserves the order your properties were written in, which JSON.parse does not — it moves integer-like keys such as "2" ahead of "b". Order only changes if you turn on Sort keys.
    How big a document can it handle?
    Up to 10 MB. Past that, parsing in a browser tab stops being instant and starts being a freeze, so the tool refuses with a clear message instead of hanging. Very large results are shown without syntax colours to keep the page responsive.