views:

458

answers:

2

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?

+1  A: 

The Json.NET library can serialize to and from Dictionary<string, string>, although I don't know if it can deserialize lists of dictionaries. I was trying to figure that out when I came across this question :)

Seth Petry-Johnson
+2  A: 

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.

Bob
Hidden gem! Very useful.
Coder 42