Kash Farooq's software development blog

I’m seeing quite a lot of people arriving at this blog with searches such as “datacontractjsonserializer .net 4”.

They end up at one of my old posts: Creating .NET objects from JSON using DataContractJsonSerializer. Implementing this will work in .NET 4, but why would you want to use DataContractJsonSerializer when you can use .NET 4 dynamic objects instead?

So, here is a very short blog post describing how to do just that.

I’m using some JSON I got from the Rotten Tomatoes API (which is excellent by the way). The JSON is all in one line so click hover over it and click the View Source icon to see it in a scrollable pop-up window.

I have put the above JSON into a text file which I’ll access via a test:

In the above code I’m using Json.Decode, which is in System.Web.Helpers, to create a dynamic object out of the JSON…

View original post 21 more words