I am writing a C# app that is supposed to get event data from JSON
Assuming my JSON response looks like below, how do I get the city_name, image url, date and list of owner names from the response? In JSON below, image could be null and so could be owners.
Also, how would I download the image and show it in my Image control?
{
"total_items": "24",
"page_number": "1",
"page_size": "10",
"page_count": "3",
"events": {
"event": [
{
"url": "<event-1-url>",
"id": "event-1",
"city_name": "Seattle",
"description": "car show event",
"image": { <-- THIS COULD BE NULL, HOW TO HANDLE NULL VALUE?
"thumb": {
"width": "32",
"url": "<image_url>/carshow.jpg",
"height": "32"
}
},
"date": "2015-12-09 13:20:20",
"owners": { <-- THIS COULD BE NULL OR MULTIPLE OWNERS, HOW TO GET ALL OWNERS NAMES?
"owner": [
{
"name": "John Doe",
"id": "O12",
"bio": "fast track racer"
},
{
"name": "Tom Tomasson",
"id": "O513",
"bio": "fines collector"
}
]
},
},
{
"url": "<event-2-url>",
"id": "event-2",
"city_name": "Blaine",
"description": "toyota event",
"image": null, <-- NO IMAGE IS PROVIDED
"date": "2015-12-09 13:20:20",
"owners": null, <-- NO OWNER IS PROVIDED
},
{...}
]
}
}
Thanks