Deserialize JSON with C#

You’re using JQuery, making some fancy ajax requests, but tired of Request[“setting”] to get data from client-side, starving for a strong-typed approach? STOP! I’ve got just what you need, and supports single object, and even lists of objects (arrays)!

Example:

For the single, the .NET Framework has the key, you need to create a class that has public fields or properties matching the field names on your JSON string, example:

And the code to serialize your Single JSON is this:

and voilá! you got yourself a strong-typed object with client-side data, sweet!

But and if I want a list of data of the same type, say an Array, how is it done? The .NET Framework hasn’t got the answer for this one..
You have to download and reference the following DLL

Once it’s done:

and yes! you’re done 🙂

How easy is this? It’s perfect for your lightweight ajax applications with .NET backend.

Please post comments!

See you soon