Peter17 Peter17 - 1 year ago 42
JSON Question

How to set formatting with JavaScriptSerializer when JSON serializing?

I am using JavaScriptSerializer for serializing objects to the file to the JSON format. But the result file has no readable formatting. How can I allow formating to get a readable file?

Answer Source

It seemed to be that there is no built-in tool for formatting JSON-serializer's output.
I suppose the reason why this happened is minimizing of data that we send via network.

Are you sure that you need formatted data in code? Or you want to analize JSON just during debugging?

There is a lot of online services that provide such functionality: 1, 2. Or standalone application: JSON viewer.

But if you need formatting inside application, you can write appropriate code by yourself.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download