I am using the jsSerilizer to parse Json and get the value of the fields. It is working for most of the Json. But I have 1 json that is not working the format of Jason is like:
{
"items": [
{
"geolocation": {
"country": "US",
"region": "Unknown",
"city": "Unknown"
},
And my code to serialize is like:
IRestResponse response = GetLogs(formattedDate);
JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
var jsobj = jsSerializer.Deserialize<dynamic>(response.Content); //response.Content contain the Json data
string geolocation = jsobj[0]["geolocation"]["country"]; //error
I get this error at this line:
string geolocation = jsobj[0]["geolocation"]["country"];
error:
The best overloaded method match for 'System.Collections ...
Go to the complete details ...