Format JSON compact or pretty