JSON Formatter and Validator

Paste JSON, then format, minify or validate it.

Your input stays in your browser.

Last reviewed

Use the JSON formatter to see structure

The JSON formatter validates syntax and can display nested objects and arrays with two spaces of indentation. Paste a document and choose Format for a readable view, Minify for a compact representation, or Validate to check syntax while leaving your text in place. Blank lines and spaces outside strings can change how JSON looks without changing the text inside its quoted values.

Work through a small configuration

Paste a compact object with two fields, for example {"items":[1,2],"label":"New York"}. Format gives the object keys their own lines and puts the two array elements on separate lines. Minify removes the indentation and line breaks. In both results the array still contains two elements, and the space between New and York remains because it sits inside a quoted string.

Understand what Validate checks

JSON requires double quotes around object keys and string values. A trailing comma after the final member of an object or array will fail validation. JavaScript object literals can contain syntax that JSON does not, so a snippet copied from source code may need editing. Validation checks the syntax of the text and does not check whether an app expects particular keys or types.

Preserve how numbers and strings were written

The tool checks syntax and changes whitespace around tokens. It leaves the original number spelling, string escapes and key order in place. For example, the integer 9007199254740993 stays as entered. Some JavaScript applications will still round it when they read it into a standard number. Repeated keys can also be interpreted differently across software, so check the consuming app if your document uses them.

Know when to use a file-based formatter

The input limit is 200,000 characters, and formatting deeply nested documents may hit an additional limit. Very large or deeply generated files are better handled in a local editor that can process them as files. Copy the result only after choosing the mode you want. Formatting is done in your browser, and the page leaves invalid input available for you to correct.

Frequently asked questions

What does pretty printing do?

It puts values on separate lines and indents nested levels by two spaces.

Can minifying remove a space inside a string?

Spaces inside strings are preserved.

Does validation check against a JSON Schema?

It checks JSON syntax. Use a schema validator for required fields and types.

What happens to large integers?

Their written digits stay intact during formatting. The receiving application may interpret them differently.

Are trailing commas valid?

JSON requires the last item or member to end without a trailing comma.

Is there a size limit?

Input is limited to 200,000 characters. Large formatted documents can hit an additional limit.

Next step Word Counter

More free tools