Added support for weak types in. net 4. It provides a way to exchange data with weak objects. We often encounter the scenario of converting a json string into an object, although we can use
JavaScriptSerializer orDataContractJsonSerializer
However, some corresponding entity classes are still required, which is very troublesome. I checked the information online and found another implementation method:
Usage:
json = j = len = obj1 = j[ name = j[].name;
Note that the dynamic type is used here. Here, the power of the weak type is highlighted.
Let's look at the specific implementation class:
dynamic FromJson(= JavaScriptConverter[] { = jss.Deserialize(jsonStr, ()) Deserialize(IDictionary<, > (dictionary == ArgumentNullException( (type == ( IDictionary<, > Serialize( IEnumerable<Type> { ReadOnlyCollection<Type>( List<Type>( Type[] { ( IDictionary<, > Dictionary { ; DynamicJsonObject(IDictionary<, >.Dictionary = TryGetMember(GetMemberBinder binder, = (result IDictionary<, >= DynamicJsonObject(result IDictionary<, > (result ArrayList && (result ArrayList) IDictionary<, >= List<DynamicJsonObject>((result ArrayList).ToArray().Select(x => DynamicJsonObject(x IDictionary<, > (result = List<>((result
Refer:
Http://www.codeproject.com/Articles/349646/Dynamic-JSON-parser
Http://msdn.microsoft.com/zh-cn/library/dd264736.aspx
Http://www.oschina.net/question/89964_45078
Http://stackoverflow.com/questions/6201529/turn-c-sharp-object-into-a-json-string-in-net-4