Hey smart people,
Hope you are all well. Please, can someone help me with my C# and json code, I'll be super grateful.
Here's the content of my mydata.json file which has to be loaded from URL
I've learnt a little about json, got to know what arrays and objects are but still stuck with my C# app.global.data.retrieve(
{
"Status": "SUCCESS",
"total": 3,
"results":
{
"Platform": [
{
"type": "AA",
"Id": "420",
"service": false,
"description": "",
"imageUrl": "http://www.somelink.com/file.jpg",
"date": "1457608735000"
},
{
"type": "BB",
"Id": "307",
"service": false,
"description": "",
"imageUrl": "http://www.somelink.com/file.jpg",
"date": "1457608782000"
},
{
"type": "CC",
"Id": "114",
"service": true,
"description": "",
"imageUrl": "http://www.somelink.com/file.jpg",
"date": "1457611015000"
}]
}
})
Please guys, I need slight help with my code. I'm really stuck with it : (
On the click of the button I am looking to retrieve json data from the above file, which will be on the external web address: http://www.mydomain.com/mydata.json
By the way, I don't need all of the data. I'm looking to retrieve all json object data from "type":"CC" part only (in this case 3rd object).
I'm using json.net;
Another thing. Sometimes, mydata.json file might generate 3rd object "type":"CC" below twice or three times. However, the ID part on that CC will always be different.
{
"type": "CC",
"Id": "114",
"service": true,
"description": "",
"imageUrl": "http://www.somelink.com/file.jpg",
"date": "1457611015000"
}
"type": "CC",
"Id": "114",
"service": true,
"description": "",
"imageUrl": "http://www.somelink.com/file.jpg",
"date": "1457611015000"
}
If that to happen, I only need to retrieve data from the last "CC" object in this case.
Another case might happen is that sometimes mydata.json file will generate only first two objects "AA" and "BB". If this happens (IF type "CC" is not printed) I need in the code to have IF() statement, to determine what to do.
I very much need C# code to confirm (perhaps "success" label) that mydata.json content is loaded successfully before it will be shown on the window.
Please guys, can someone help me with the code bit? I need something simple, less messy.
I won't be able to give you a hug or contribute towards for your help, but definitely guarantee a genuine "Thank you" from a stranger. Hope this matters.

Rajeev PunhaniPosted Jul 14, 2016, 7:35 AM
If the above solution is helpful then,accept the answer.
TommyPosted Jul 17, 2016, 4:12 AM
Raja TPosted Jul 15, 2016, 9:55 AM
>(json);
TommyPosted Jul 14, 2016, 11:54 AM
TommyPosted Jul 12, 2016, 2:34 AM
Raja TPosted Jul 12, 2016, 12:26 AM