Recently i’m working with the dailymotion video API. However I not sure how to convert the returned data into my ASP.NET C# application.
GET
https://api.dailymotion.com/videos?search=fun&page=3
RESULT
{ "page": 1,
"limit": 2,
"total": 218248,
"has_more": true,
"list": [
{ "id": "xrk9mi",
"title": "Priyanka & Shahid Kapoor get MOBBED in local train",
"channel": "fun",
"owner": "xlw7uu"
},
{ "id": "xrk8fy",
"title": "What's Up With Gaga?: Hit On Head, Perfume Bottle Leaked, Thai Fans Angry",
"channel": "music",
"owner": "xofeoz" }
]
}
You would declare a class that matches up with what you’re getting back, let’s break it down into parts, starting with the outer class declaration:
So I’ll do the same with XXX which needs to be a separate type so we can make an array of them:
Which requires us to go back and put that name into our first declaration:
And then you can convert the received object into this object via many methods, depending on which .NET version you’re using.
Since you’ve already got it as a string, I’m going to assume the string is called “result”: