Home >Backend Development >C++ >Can Json.Net Deserialize JSON into a Dynamic Object?
JSON.NET can disadvant the JSON object into a dynamic object? For example:
Answer:
<code class="language-csharp">dynamic jsonResponse = JsonConvert.DeserializeObject(json); Console.WriteLine(jsonResponse.message);</code>
Yes, json.net can achieve this:
Output:
<code class="language-csharp">dynamic d = JObject.Parse("{number:1000, str:'string', array: [1,2,3,4,5,6]}"); Console.WriteLine(d.number); Console.WriteLine(d.str); Console.WriteLine(d.array.Count);</code>Please refer to the
linq to json document
by json.net. In addition, please consider using and<code>1000 string 6</code>.
The above is the detailed content of Can Json.Net Deserialize JSON into a Dynamic Object?. For more information, please follow other related articles on the PHP Chinese website!