Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET - JSON Data - Deserialization - Lists & Dictionaries

Tags:

I need to pull back from a database JSON documents that are not based on a standard object.

Is there a way using .NET to "deserialize" these documents into Lists & Dictionaries of primitive objects (string, int, bool, etc...)

Any library that can do this in both directions?

like image 494
BuddyJoe Avatar asked Jul 17 '09 20:07

BuddyJoe


1 Answers

In the .NET 3.5 Framework you can use System.Web.Script.Serialization.JavaScriptSerializer. Using the Deserialize method will return an object which you can cast to a Dictionary type or Object[] depending on what's in the JSON string.

like image 84
Bob Avatar answered Oct 04 '22 20:10

Bob