Articles → .NET → Read JSON text using newtonsoft JSON library in C#
Read JSON text using newtonsoft JSON library in C#
Installing library
Click to Enlarge
Read JSON
using Newtonsoft.Json;
using System;
namespace ReadJson
{
class Program
{
static void Main(string[] args)
{
string json = "{\"Name\": \"Karan Gupta\",\"Age\": 28,\"Technology\": \"JSON\",\"Address\":{\"City\": \"Gurgaon\",\"State\": \"Haryana\"}}";
dynamic jsonObj = JsonConvert.DeserializeObject(json);
Console.WriteLine(jsonObj.Name);
Console.ReadLine();
}
}
}
Output
Click to Enlarge