Asp.net ajax (3.5) serialization and extension methods

ok, so the IDE is much slower when designing web forms, but other than that VS 2008, the 3.5 flavor of Asp.Net Ajax, and .net 3.5 in general rock the casbah big time.

For example, today I had to whip up a little code to serialize a small object graph to the client, so that I can allow users to interact with a couple UI controls, whose combined selection displays a result.  It would be crazy to do a postback, and even silly to do an async ajax retrieval, as simply caching the object graph yields the very best user experience.

The new System.Runtime.Serialization.Json.DataContractContractJsonSerializer rocks.  Combine that with a tiny extension method (see this article)  and the serialization is easy.  On the client-side, just use the Sys.Serialization.JavaScriptSerializer.deserialize(‘[your JSON here]’) and you are off and running.  Very clean, very simple, very nice job Microsoft!

 OH, by the way, i’m using the ajax slider, very slick as well! 

 J

1 thought on “Asp.net ajax (3.5) serialization and extension methods

Leave a comment