JSON Formatter and Validator

Paste JSON to check that it is valid and turn it into readable, indented text or a compact single line. Everything runs in your browser.

Enter JSON here

Paste your JSON and format or validate it

Formatted JSON

How to use the JSON formatter

Formatting changes the whitespace, not the structure. Because the text is parsed by your browser's JSON engine, three details can differ from your input, and it is worth knowing them before you copy the result back:

What makes JSON valid

JSON (JavaScript Object Notation) is a text format for structured data, defined by RFC 8259 and ECMA-404. It looks like JavaScript, but it is much stricter, and most validation errors come from habits that JavaScript allows and JSON does not:

Readable or compact?

Indented JSON is easier to read, review and compare in version control, so it suits configuration files, documentation and debugging an API response. Compact JSON removes every unnecessary space and line break, which makes payloads smaller for storage and network transfer. Both forms contain exactly the same data.

Your data stays in your browser

The formatter runs entirely on your device. The JSON you paste is not uploaded to our servers, so you can safely format responses that contain internal data. See the privacy policy for details.

Related tools

Frequently asked questions

Why does valid JavaScript fail here?

A JavaScript object literal can use unquoted keys, single quotes, trailing commas and comments. JSON allows none of these. Remove them and the input will validate.

Does the formatter sort or change my keys?

It does not sort them, with one exception: keys that look like whole numbers are placed first, in numeric order, because that is how JavaScript engines store object keys. If the same key appears twice in one object, only the last value is kept.

Is there a size limit?

There is no fixed limit. Because formatting happens in your browser, very large documents, typically tens of megabytes, depend on your device's memory and may take a moment.