Answers for "how to parse json to object in c#"

C#
0

parse json C#

dynamic stuff = JsonConvert.DeserializeObject("{ 'Name': 'Jon Smith', 'Address': { 'City': 'New York', 'State': 'NY' }, 'Age': 42 }");
string name = stuff.Name;
string address = stuff.Address.City;
// Or using Newtonsoft.Json.Linq 
dynamic stuff = JObject.Parse("{ 'Name': 'Jon Smith', 'Address': { 'City': 'New York', 'State': 'NY' }, 'Age': 42 }");
string name = stuff.Name;
string address = stuff.Address.City;
Posted by: Guest on August-05-2021
-1

parse json c#

using Newtonsoft.Json.Linq;

var res = "{'name': 'bob'}";
var Answer = JObject.Parse(res);
Console.Write(Answer);
Posted by: Guest on March-15-2022

C# Answers by Framework

Browse Popular Code Answers by Language