Convert JSON to Value |
This sample converts LINQ to JSON objects to .NET types using ToObjectT.
JValue v1 = new JValue(true); bool b = v1.ToObject<bool>(); Console.WriteLine(b); // true int i = v1.ToObject<int>(); Console.WriteLine(i); // 1 string s = v1.ToObject<string>(); Console.WriteLine(s); // "True"