Is there a way to deserialize JSON content into a C# 4 dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer.
相关问题
- Jackson Deserialization not calling deserialize on
- Sorting 3 numbers without branching [closed]
- How to maintain order of key-value in DataFrame sa
- Graphics.DrawImage() - Throws out of memory except
- StackExchange API - Deserialize Date in JSON Respo
Another way using Newtonsoft.Json:
There is a lightweight json library for C# called SimpleJson which can be found at
http://simplejson.codeplex.comhttps://github.com/facebook-csharp-sdk/simple-jsonIt supports .net 3.5+, silverlight and windows phone 7.
Supports dynamic for .net 4.0
Can also be installed as a nuget package
Its probably a little late to help you but the object you want DynamicJSONObject is included in the System.Web.Helpers.dll from the ASP.NET Web Pages package, which is part of WebMatrix.
Another option is to "Paste JSON as classes" so it can be deserialised quick and easy.
Here is a better explanation n piccas... https://blogs.msdn.microsoft.com/webdev/2012/12/18/paste-json-as-classes-in-asp-net-and-web-tools-2012-2-rc/
Simple "string json data" to object without any third party dll
Note : You can also using your custom object.
Simplest way is
Just include this dll
use the code like this