This is a lightweight beautifier - it indents code blocks, if/else/try/catch, and statements well, but object literals are left exactly as typed rather than risk reformatting them incorrectly.

Input JavaScript

Beautified JavaScript