Below JSON is WWW
GET result
{
"status":200,
"watchlist":[
{
"Category":"Movie",
"ShowList":[
{
"id":"59534a851339762f38e16ad7",
"Name":"Play zombie tonight",
"Description":"descblablabla",
"IMDB":1,
"Tag":[
"horror",
"comedy"
],
"Picture":{
"id":"59534a8b1339762f38e16b6d",
"Url":"imgurlbla",
"DisplayOrder":0
}
}
]
},
{
"Category":"Variety",
"ShowList":[
{
"id":"59532bf51339742f380d4cb1",
"Name":"Yearning for life",
"Description":"descblablabla",
"IMDB":1,
"Tag":[
"reality show"
],
"Picture":{
"id":"59532bfb1339742f380d4d3a",
"Url":"imgurlbla",
"DisplayOrder":0
}
}
]
}
]
}
I want to assign the result to List<>
, so can I easily access the value in WatchList
. Below is the code I tried.
List<WatchList> viewitemlist = JsonUtility.ToJson (www.text);
I also have tried a library called LitJSON :
string json = www.text;
JsonData jsonObject = JsonMapper.ToObject(json);
List<On360WatchList> viewitemlist =
JsonMapper.ToObject<List<On360WatchList>> (jsonObject ["watchlist"].ToJson());