JSON Formatter and Validator

Format JSON without rounding numbers, find duplicate keys and search a tree of values and paths.

On-device No sign-up Free to use

Process JSON controls

Showing an example. Edit to see your own.

Drop your file here

or choose one from your device

Optional UTF-8 text up to 10,000,000 bytes. A chosen file replaces pasted text.

    ?

    Paste JSON text. It is parsed in your browser and never uploaded.

    Action
    ?

    Used when formatting.

    ?

    Opt-in punctuation repair only. No missing braces, unquoted names, comments, evaluation or general JSON5 support. Review the changed output.

    Processed in your browser. Your inputs stay on this device.

    Result

    Showing an example.

    Indent a small object containing a product name, two items and a stock flag.

    {
      "name": "Example",
      "items": [
        "pen",
        "paper"
      ],
      "inStock": true
    }

    Loading the tool. Your result will appear here.

    https://usefreetools.net/json-formatter · 20 November 2026

    Was this helpful?

    How to use JSON Formatter and Validator

    1. Paste one JSON document or choose a UTF-8 JSON file. The selected file replaces pasted text.
    2. Choose Format and indent, Minify or Validate only. For formatting, choose indentation and optional object-key sorting.
    3. If the source uses single-quoted strings or trailing commas, explicitly enable the limited repair option. Comments, missing braces and general JSON5 remain unsupported.
    4. Review syntax errors, warnings and the bounded tree preview. Copy or download the complete rewritten JSON when formatting or minifying; validation alone does not export a rewrite.
    5. Review duplicate-key locations, search the tree by key, value or path, and copy a path beside a visible value.

    Example: JSON Formatter and Validator

    Indent a small object containing a product name, two items and a stock flag.

    You add
    JSON: {"name":"Example","items":["pen","paper"],"inStock":true}; Action: format; Indentation: 2; Sort object keys alphabetically: false; Repair single-quoted strings and trailing commas: false
    You get
    { "name": "Example", "items": [ "pen", "paper" ], "inStock": true }

    Options

    Action
    Format and indent rewrites the document with line breaks, Minify removes every optional space, and Validate only reports whether the JSON is valid without producing any output.
    Sort object keys alphabetically
    Reorders the keys of every object, at any depth, before formatting or minifying. Array order is never changed. Useful when you want two JSON files to diff cleanly.
    Collapsible tree
    Open individual objects and arrays, choose an expansion depth or collapse the visible tree. The preview is bounded to 1,000 nodes and 40 levels and shortens long values. Copy and download contain the complete formatted or minified JSON.
    Choose JSON file
    JSON Formatter and Validator: Optional UTF-8 text up to 10,000,000 bytes. A chosen file replaces pasted text.
    JSON
    Paste JSON text. It is parsed in your browser and never uploaded.
    Indentation
    Used when formatting.
    Repair single-quoted strings and trailing commas
    Opt-in punctuation repair only. No missing braces, unquoted names, comments, evaluation or general JSON5 support. Review the changed output.
    Lossless numeric output
    Formatting and minifying preserve each original number token, including large integers, decimal precision, exponents and negative zero.
    Duplicate-key diagnostics
    Repeated names in the same object are reported with line and column positions. Both values stay in the exported JSON.
    Tree search and paths
    Search the bounded preview and copy bracket-notation paths. Repeated keys share a path; consult the duplicate-key locations to distinguish them.

    Supported inputs and limits

    • Standard JSON only, with optional limited repair of single-quoted strings and trailing commas.
    • Comments, expressions and general JSON5 are unsupported.
    • Input is capped at 10,000,000 characters, 200 nesting levels and 200,000 values.
    • Formatting retains numeric tokens and duplicate keys.
    • The tree preview is limited to 1,000 nodes and 40 levels; search covers that bounded preview.
    More details

    The exported document is complete.

    Validate only does not export a rewrite.

    Where your input is processed

    This tool does not upload your inputs. See the limits for anything saved on your device.

    Keep the original numeric value

    A JSON number can contain more precision than a JavaScript floating-point value. This formatter writes the original number token instead of converting it back from a floating-point number. That preserves long IDs, trailing decimal zeros, exponent notation and negative zero. Duplicate-key warnings also matter: keeping both occurrences prevents silent deletion, but consumers can interpret repeated names differently.

    Questions about JSON Formatter and Validator

    Can I format JSON that contains comments or trailing commas?

    Comments are unsupported. Strict parsing also rejects trailing commas and single-quoted strings. Turn on Repair single-quoted strings and trailing commas to repair those two punctuation cases, then review the changed document.

    What does Validate only tell me when the JSON is good?

    It reports the root value, such as an object with 4 keys or an array with 12 items, and a table counting objects, arrays, strings, numbers, booleans, null values, keys and the deepest nesting. It does not print the document back.

    How precise is the error position?

    The tool reports a line and a column, and falls back to its own scanner when the browser's error message omits a position. Treat the position as a starting point, since the real problem is sometimes one line earlier, such as a missing comma.

    Will formatting round long numbers or discard duplicate keys?

    No. Exported JSON keeps the original numeric tokens and every duplicate key. Duplicate names are reported with locations. Other software may still round numbers or keep only the last duplicate value when it reads that JSON.

    Page updated · Project managed by Tony Hines · Report a problem with JSON Formatter and Validator

    Related reading

    All guides