RUN

JSON Formatter and Validator

Paste JSON to beautify, validate or minify it. Errors point to the exact line and column.

Runs in your browser · nothing is uploaded

How to use the JSON Formatter

  1. Paste your JSON into the input box, or open a .json file.
  2. Pick an indent (2 spaces, 4 spaces or tabs) or Minify. Turn on Sort keys to order every object alphabetically.
  3. The formatted result appears on the right as you type. If the JSON is invalid, the error says what is wrong and on which line and column.
  4. Copy the result or download it as a .json file.

About this tool

JSON is the format almost every API, config file and NoSQL database speaks, and it is strict: one trailing comma or a single-quoted key and the whole document fails to parse. This formatter uses your browser’s own JSON parser, the same one your JavaScript code uses, so if it says the JSON is valid, JSON.parse will accept it too.

Formatting adds line breaks and indentation so nested objects are easy to read, which helps when you are checking an API response or a webhook payload. Minifying does the opposite and strips every unneeded space, which makes the payload smaller to send or store. Sorting keys makes two versions of the same object line up, which is handy before comparing them with the JSON compare tool.

Very large numbers are worth a note: JSON allows any number of digits, but JavaScript stores numbers as 64-bit floats, so integers above 9,007,199,254,740,991 (for example, some database IDs) lose precision when parsed. If you work with such IDs, keep them as strings in your JSON.

Frequently asked questions

›Why does my JSON fail to parse?

The most common causes are a trailing comma after the last item, keys or strings in single quotes, comments (JSON has none), unquoted keys, and special values like NaN or undefined. The error message and line number show where the parser stopped.

›What is the difference between formatting and minifying?

Formatting adds indentation and line breaks for people to read. Minifying removes all optional whitespace so the data is as small as possible for machines. Both contain exactly the same data.

›Does sorting keys change my data?

No. JSON objects have no meaningful key order, so a sorted object is the same data. Arrays keep their order, because order matters in arrays.

›Is my data sent anywhere?

No. The tool runs entirely in your browser with JavaScript. What you paste is never uploaded, logged or stored on our servers, so it is safe to use with internal data, though you should still treat secrets with care on shared computers.

›Can I format a big JSON file?

Yes. Files of several megabytes format in well under a second on a normal laptop, because nothing is uploaded and everything happens on your device.