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