I am reading some JSON and converting it to a dynamic list. Below is My Code:
dynamic data = JObject.Parse(response);
var result = data.result;
var result = ((IEnumerable)arr).Cast<dynamic>().ToList();
var id = result[0].id;
var filtereddata = result.Where("id==1");
The line
var filtereddata = result.Where("id==1");
Gives error No property or field 'id' exists in type 'Object
while var id = result[0].id;
seems to be working.
The JSON I am parsing is :
{
"count": 1,
"result": [
{
"id": 11,
"name": "Locations",
}]
}
Please let me know if more information is needed. Thanks for your valuable time.
Edit:
Even tried var filtereddata = result.Where(c=>c.id==1).Select("id");
using lambda expression but still the same issue.