Create a small utility class to pretty-print JSON

Also use it to format the data in the result page, provided that it is valid.
Remove dead code