I need to fetch some values obtained from an web URL.
The JSON is as given:
{"country":{"name":"India","State":"Raj": Count :239}, "Population": 25487}
Now i want to fetch the value of Count and Population using C#.
I have tried using JavaScriptSerializer(); But the problem is that its response time is much much slower.
Please suggest me a way to fetch the values from this JSON string.
Thanks
I personally use
https://github.com/ServiceStack/ServiceStack.Text
It’s a very fast JSON serializer/deserializer.
I usually create an extension method to make the code tidier:
Edit:
A quick way to fetch those values would be to create a class of the data:
Then, using ServiceStack:
You can then get the values from FeedResult as such:
FeedResult.Country.name;