Home >Backend Development >C++ >How to Deserialize JSON into C# Dynamic Objects using Json.NET or Newtonsoft.Json.Linq?
Use json.net
<code class="language-csharp">dynamic stuff = JsonConvert.DeserializeObject("{ 'Name': 'Jon Smith', 'Address': { 'City': 'New York', 'State': 'NY' }, 'Age': 42 }"); string name = stuff.Name; string address = stuff.Address.City;</code>use newtonsoft.json.linq
<code class="language-csharp">dynamic stuff = JObject.Parse("{ 'Name': 'Jon Smith', 'Address': { 'City': 'New York', 'State': 'NY' }, 'Age': 42 }"); string name = stuff.Name; string address = stuff.Address.City;</code>Document
The above is the detailed content of How to Deserialize JSON into C# Dynamic Objects using Json.NET or Newtonsoft.Json.Linq?. For more information, please follow other related articles on the PHP Chinese website!