Skip to content
QuickKit 100% free · no login

Home › Developer Tools › JSON Formatter & Validator

JSON Formatter & Validator

Runs in your browserFree · no sign-up

Paste JSON, choose an indent, and press Format. Invalid JSON is reported with its position so you can fix it quickly.

Advertisement

What a JSON formatter does

JSON (JavaScript Object Notation) is the most common format for sending data between web services and storing configuration. Machines read it happily without spaces, so API responses are often a single long line that is hard for a person to read. A formatter parses the text and writes it back with consistent indentation, one item per line, which makes the structure visible. A minifier does the reverse and removes every optional space to save bytes. This page does both, and also checks that your text is valid JSON.

How validation works

The tool hands your text to the JSON parser that is built into your browser, the same one web applications use. If the text is valid, it is re-serialised with your chosen indent. If not, the parser's error message is shown together with the line and column, worked out from the character position it reports. Typical mistakes include a trailing comma after the last item, single quotes instead of double quotes, unquoted property names, comments (which JSON does not allow) and missing commas between items. Strict parsing means that what passes here will also pass in most programming languages.

Options

  • Indent: two spaces is common in JavaScript projects, four in many other languages, and tabs suit editors that let you set the width.
  • Sort keys: orders every object's keys alphabetically at all depths. This is helpful when comparing two JSON files, since the same data then looks the same. Array order is never changed.
  • Minify: produces the compact form for embedding in code, URLs or network payloads.

Things to know

JSON numbers follow JavaScript rules, so integers larger than 9,007,199,254,740,991 lose precision when parsed. If you work with large identifiers, keep them as strings. Duplicate keys in the same object are accepted by the parser, and the last one wins, so one of them disappears from the output. Special values such as NaN, Infinity and undefined are not valid JSON.

Privacy

Everything happens locally. The text you paste is not uploaded, logged or stored, so it is reasonable to use the tool with internal data, although you should still avoid pasting live secrets into any website out of habit.

Frequently asked questions

How do I format JSON online?

Paste the JSON into the input box, choose an indent and press Format. The result appears in the output box and can be copied with one click.

Why does it say my JSON is invalid?

Common causes are trailing commas, single quotes, unquoted keys and comments. The message includes the line and column of the first error.

Does the formatter change my data?

No. Only whitespace changes, unless you tick "Sort object keys", which reorders keys but not array items.

Is my JSON sent to a server?

No. Parsing and formatting run in your browser.

What is the difference between formatting and minifying?

Formatting adds indentation and line breaks for readability. Minifying removes all optional whitespace to make the text as short as possible.

More free tools