.NET - JSON data - deserialization - lists and dictionaries

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

Is there a way to use .NET to β€œdeserialize” these documents into lists and dictionaries of primitive objects (string, int, bool, etc.)

Any library that can do this in both directions?

+5
source share
2 answers

In the .NET 3.5 Framework, you can use System.Web.Script.Serialization.JavaScriptSerializer . Using the Deserialize method will return an object that you can apply to the Dictionary or Object [] type, depending on what is in the JSON string.

+3
source

The Json.NET library can serialize to and from Dictionary<string, string>, although I don’t know if it can deserialize the dictionary lists, I tried to figure it out when I came across this question :)

+2
source

All Articles