# JSON formatter & validator

> Validate, format or minify JSON without rounding large numbers or changing string content. Copy the result or download a JSON file.

- Canonical HTML: [https://unrust.dev/tools/json-formatter](https://unrust.dev/tools/json-formatter)
- Markdown representation: [https://unrust.dev/tools/json-formatter/index.md](https://unrust.dev/tools/json-formatter/index.md)

## How to use the tool

Paste JSON, choose 2-space or 4-space indentation, or select Minify. Invalid input clears the output. Limits are 200,000 input characters, 100 nesting levels and 1,000,000 output characters. Valid JSON syntax does not establish schema validity; duplicate keys are preserved, not resolved.

## Worked example

The sample ID 9007199254740993 stays exactly as written. The formatter validates syntax and changes only whitespace outside strings, preserving numeric literals, duplicate keys and key order.

```text
{"id":9007199254740993,"enabled":false}
```

Inputs stay in your browser. These are open learning examples, not scored diagnostic drills.

[Format JSON without changing the data](https://unrust.dev/blog/format-json-without-changing-data/index.md)

[MDN: JSON and number precision](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON)

## Practice checking a data contract

A payload contains {"enabled":"false"}. The formatter accepts it. Does that prove enabled is a Boolean?

No. "false" is a string. JSON syntax validation does not establish a field’s expected type. Read the consumer’s contract and test the boundary where the payload becomes application data.

Original open example, not a scored drill. Close tools before an unassisted session.

[Practice reading code against its contract](https://unrust.dev/guides/reading-code-against-a-contract/index.md)

[Take the free diagnostic](https://unrust.dev/diagnostic/index.md)
