JSON Formatter

Pretty-print, validate and minify JSON, with the line and column of any error and an option to sort keys. Your JSON stays in your browser.

Also searched as: json beautifier · json validator · format json · pretty print json

Loading the tool…

How to use it

  1. 1

    Paste your JSON

    Drop in the JSON you want to tidy.

  2. 2

    Format or minify

    Choose an indent and press Format, or Minify to make it compact.

  3. 3

    Copy the result

    Copy the formatted output, or read the error if the JSON is invalid.

Questions about json formatter

Will it tell me where an error is?

Yes. Invalid JSON shows a message with the line and column of the problem.

Can it sort the keys?

Yes, tick "Sort keys A–Z" to order every object alphabetically.

Is my JSON uploaded?

No. Formatting runs entirely in your browser.

Fixing JSON that will not parse

When the JSON is invalid, the tool shows the line and column of the problem. The most common causes are a comma after the last item in a list or object, single quotes where double quotes are required, a key that is not wrapped in double quotes, and a missing comma between two items. Comments are not allowed in JSON, so remove any lines that start with // or sit inside slash-star pairs.

Fix the first error and format again, because one mistake can make later lines look wrong.

Format, minify and sort

Format adds indentation so the structure is easy to read, which is what you want when debugging an API response. Minify removes all the extra space to make the text as short as possible, which is useful before sending it or storing it. Sorting keys A to Z puts every object in alphabetical order, which makes two versions of the same data easier to compare.

The work happens in your browser, but still avoid pasting passwords, tokens or other secrets into any web page when you can use a sample instead.

Related tools