http://jsbeautifier.org/

Don’t know how well it works.