I tried so many things but i am unable to get the section under objects out
API Output
"objects": [
{
"date": "Mon, 11 Sep 2017 00:00:00 GMT",
"images": [
{
"naturalHeight": 298,
"width": 810,
"url": "https://www1.google.com/files/2017/09/Feature-Image-810x298_c.png",
"naturalWidth": 810,
"primary": true,
"height": 298
},
{
"naturalHeight": 393,
"width": 300,
"title": "8 Ways to Enter",
"url": "https://www1.google.com/files/2017/09/Feature-Image-810x298_csss.png",
"naturalWidth": 563,
"height": 223
},
{
"naturalHeight": 300,
"width": 169,
"url": "https://www1.google.com/files/2017/09/Feature-Image-810x298_themec.png",
"naturalWidth": 169,
"height": 297
},
{
"naturalHeight": 300,
"width": 169,
"title": "Before: Android Oreo’s Stock, Light UI",
"url": "https://www1.google.com/files/2017/09/Feature-Image-810x298_dec.png",
"naturalWidth": 169,
"height": 297
}, ...... continue
I need to get the first image in which the PRIMARY = TRUE
I tried the following with no luck
var dirs = JObject.Parse(json)
.Descendants()
.Where(x=>x is JObject)
.Where(x=>x["primary"]!=null && x["url"]!=null)
.Select(x =>new { URL= (string)x["primary"], PRIMARY = (string)x["url"] })
.ToList();
var id = dirs.Find(x => x.Primary == "true").URL;