Developer Tools

JSON Formatter & Validator

Format, validate and minify JSON, or sort keys without rounding numbers. Paste text or open a local JSON file.

Your inputs

JSON numbers are preserved exactly. Input limit: 2 MiB.

Your results

Format JSON without rounding numeric identifiers

Validate JSON syntax and make valid input readable or compact. The parser preserves original number tokens, including large integers and decimal or exponent spellings, instead of rounding them through JavaScript numbers. This is syntax checking, not validation against your application's schema.

Step by step

  1. Paste JSON or open a local UTF-8 JSON/text file. Choose two spaces, four spaces, tabs or compact output; optionally sort object keys.
  2. Process the input. Correct the reported line and column if parsing fails; check duplicate-key warnings even when formatting succeeds.
  3. Copy, download or print the result. After editing input or options, process it again: the previous result is cleared to avoid copying stale output.

Settings and limits

What sorting changes
Sorting is lexical and case-sensitive, and applies to nested objects too. Array order is unchanged. Numeric tokens stay exact, but string escapes can be normalized; the output is not byte-identical to the source.
Strict JSON syntax
Use double-quoted keys and strings. Comments, trailing commas, NaN and Infinity are invalid. A valid top-level value can be an object, array, string, number, boolean or null.
Size and complexity
Input is limited to 2 MiB (2,097,152 UTF-8 bytes). Very deep or complex documents are also rejected: the parser guards nesting above 128 levels and more than 200,000 value nodes.

Worked example

Paste the example input below, choose compact output and enable sorting. Process it and compare the result, or open the downloadable precision-example.json file.

Download the example files

Example input

{"b":2,"a":9007199254740993}

Expected result

{"a":9007199254740993,"b":2}

Key a moves before b, while 9007199254740993 remains unchanged. A formatter based on ordinary JavaScript number conversion could round that identifier; this tool keeps its original numeric token.

Questions and troubleshooting

Why does a file that works as JavaScript fail here?

JavaScript object syntax can allow comments, single quotes or unquoted keys. JSON cannot. Fix the source explicitly; this tool does not silently repair invalid input.

Are duplicate keys removed?

No. Both entries remain and a warning is shown. Resolve duplicates before sending the JSON to another system, because different parsers can interpret them differently.

What if the Copy button is blocked?

The tool selects the output for manual copying when clipboard access fails. You can also download formatted.json. Formatting does not change your original file.