Using JSON in ASP.NET

ka_vol1_069 If you’ve been avoiding using JSON in your ASP.NET application because you think it’s hard, you’re an idiot. I can say that, because I’ve been avoiding it for exactly that reason. I’ve been an idiot too. But no more! Using an UpdatePanel is still easier than JSON. But JSON is easy enough that you may decide to use it over the UpdatePanel under certain circumstances.


The main problem with the UpdatePanel, as most know by now, is that all of the form data gets posted to the server and all of the server code runs during every update. While there are ways of detecting that the UpdatePanel is causing the postback and thereby limiting the amount of code that runs on the server, you are still left with a full submit of the client form elements to contend with. On a large form, and a form with a lot of view state information, this could be a huge consideration.

JSON, on the other hand, only sends the data that is needed for the WebService function it is calling and only returns the data that the WebService function returns. So you end up sending less data, executing less code on the server, and returning less code from the server. This can significantly increase the performance of your application as well as increase the scalability of your application.

However, it will take a lot more work to JSON-enable something like the GridView. In that case, you may decide that the cost of the development outweighs the performance gains of JSON and decide to stay with the UpdatePanel. There are places for both in your toolbox.

Related Post

2 Responses to “Using JSON in ASP.NET”

Leave a Reply

Comment Policy:

  • You must verify your comment by responding to the automated email that is sent to your email address. Unverified comments will never show.Leave a good comment that adds to the conversation and I'll leave your link in.
  • Leave me pure spam and I'll delete it.
  • Leave a general comment and I'll remove the link but keep the comment.

Notify me of followup comments via e-mail

Bear