I personally use
https://github.com/ServiceStack/ServiceStack.Text
This is a very fast JSON serializer / deserializer.
I usually create an extension method to make the code tidier:
public static string ToJson(this object _obj) { return JsonSerializer.SerializeToString(_obj); }
Edit:
A quick way to get these values is to create a data class:
public class Country { public string name { get; set; } public string State { get; set; } public int Count { get; set; } } public class CountryInformation { public Country Country { get; set; } public int Population { get; set; } }
Then using ServiceStack:
void SomeFunction(string _Json) { var FeedResult = _Json.FromJson<CountryInformation>(); }
Then you can get the values from FeedResult as such:
FeedResult.Country.name;
source share