Developer tool

JSON Formatter and Viewer

A JSON formatter turns messy JSON into readable, indented text and checks that it is valid. Paste your JSON or drop a .json file below to pretty print it, minify it, sort the keys or browse it as a tree. If something is wrong, you get the line and column of the first error. It runs in your browser.

How to format and validate JSON

  1. Paste your JSON into the input box, or drop a .json file onto it. A small sample is loaded to start.
  2. Read the line under the box. It says Valid JSON, or gives the line and column of the first error.
  3. Pick 2 spaces, 4 spaces, Tab or Minify, and tick Sort keys if you want keys in alphabetical order.
  4. Switch the result to Tree to open and close sections, or search for a key or value.
  5. Press Copy, or Download to save the result as a .json file.

What counts as valid JSON

JSON is stricter than the JavaScript it came from. Strings and keys need double quotes, items are separated by commas with none after the last one, and comments are not allowed. Values can be a string, number, true, false, null, an array or an object. undefined, NaN and Infinity are not valid.

This page reads the text with its own small parser, so it can name the exact position of a mistake the same way in every browser. It keeps numbers exactly as you typed them, so a long ID such as 12345678901234567890 is not rounded, and it keeps keys in their original order unless you ask to sort them.

Working with big files

The tree draws only what you open. Objects and lists with more than 100 entries show 100 at a time, with a button for the next batch, so a file of several megabytes stays responsive. Files over 3 MB are not placed in the text boxes at all. You can still format, search, copy and download them. Nothing is uploaded and the JSON is never added to the page address.

Related tools

Working with text too? Count it with the word and character counter or change its capitals with the case converter, which also makes camelCase and snake_case names. Need placeholder content? Use the lorem ipsum generator. Making social posts? See Instagram fonts.

JSON formatter FAQ

How do I find the error in my JSON?

Look at the line under the input box. It gives the line and column where the parser first found a problem, shows that line with a marker, and has a button that jumps the cursor there. The real mistake is often just before the marker, such as a missing comma at the end of the previous line.

What are the most common JSON mistakes?

A trailing comma after the last item, single quotes instead of double quotes, keys without quotes, comments, and a missing comma between items. JSON also does not allow undefined, NaN or Infinity as values.

What is the difference between pretty print and minify?

Pretty print adds line breaks and indentation so people can read the data. Minify removes every optional space and line break so the text is as small as possible. Both hold the same data, and numbers stay exactly as typed, so long IDs do not lose digits.

Does sorting keys change my data?

It changes only the order of keys inside objects, which JSON treats as unordered. The order of items in arrays is never changed. Sorting makes two files easier to compare line by line.

Can it open a large JSON file?

Yes. The tree shows only the parts you open and lists long arrays 100 items at a time, so files of several megabytes stay responsive. Very large files are not shown in the text boxes, but you can still format, copy and download them. The limit is 50 MB.

Is my JSON uploaded anywhere?

No. Parsing happens in your browser. Your JSON is not sent to a server and is not added to the page address. Close the tab and it is gone.

Make something with Zaps

Templates for Instagram and TikTok posts, stories and reels. Add your photos and you're done.