How to deserialize this JSON in asp.net
This is my code to Deserialize JSOn in asp.net, but it's not working.
[
{
"resultList": [
{
"channelType": "",
"duration": "2:29:30",
"episodeno": 0,
"genre": "Drama",
"genreList": [
"Drama"
],
"genres": [
{
"personName": "Drama"
}
],
"id": 1204,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/The-Great-target.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/The-Great-target.jpg",
"language": "Hindi",
"name": "The Great Target",
"productId": 1204,
"productMasterId": 1203,
"productMasterName": "The Great Target",
"productName": "The Great Target",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "2005",
"releaseyear": "2005",
"showGoodName": "Movies ",
开发者_如何转开发 "views": 8276
},
{
"channelType": "",
"duration": "2:30:30",
"episodeno": 0,
"genre": "Romance",
"genreList": [
"Romance"
],
"genres": [
{
"personName": "Romance"
}
],
"id": 1144,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/MereSapnoKiRaani.JPG",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/MereSapnoKiRaani.JPG",
"language": "Hindi",
"name": "Mere Sapnon Ki Rani",
"productId": 1144,
"productMasterId": 1143,
"productMasterName": "Mere Sapnon Ki Rani",
"productName": "Mere Sapnon Ki Rani",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "1997",
"releaseyear": "1997",
"showGoodName": "Movies ",
"views": 6472
},
{
"channelType": "",
"duration": "2:34:07",
"episodeno": 0,
"genre": "Drama",
"genreList": [
"Drama"
],
"genres": [
{
"personName": "Drama"
}
],
"id": 1520,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/SATYAMEVAJAYATHE.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/SATYAMEVAJAYATHE.jpg",
"language": "Telugu",
"name": "Satyameva Jayathe",
"productId": 1520,
"productMasterId": 1519,
"productMasterName": "Satyameva Jayathe",
"productName": "Satyameva Jayathe",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "2004",
"releaseyear": "2004",
"showGoodName": "Movies ",
"views": 9897
},
{
"channelType": "",
"duration": "2:39:06",
"episodeno": 0,
"genre": "Drama",
"genreList": [
"Drama"
],
"genres": [
{
"personName": "Drama"
}
],
"id": 9155,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/sabse_bada_mawali.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/sabse_bada_mawali.jpg",
"language": "Hindi",
"name": "Sabse Bada Mawali",
"productId": 9155,
"productMasterId": 3451,
"productMasterName": "Sabse Bada Mawali",
"productName": "Sabse Bada Mawali",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "2007",
"releaseyear": "2007",
"showGoodName": "Movies ",
"views": 18029
},
{
"channelType": "",
"duration": "2:31:00",
"episodeno": 0,
"genre": "Thriller",
"genreList": [
"Thriller"
],
"genres": [
{
"personName": "Thriller"
}
],
"id": 43,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/Kyon_292.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/Kyon_292.jpg",
"language": "Hindi",
"name": "Kyon",
"productId": 43,
"productMasterId": 42,
"productMasterName": "Kyon",
"productName": "Kyon",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3.5,
"releaseYear": "2003",
"releaseyear": "2003",
"showGoodName": "Movies ",
"views": 11558
},
{
"channelType": "",
"duration": "2:16:50",
"episodeno": 0,
"genre": "Drama",
"genreList": [
"Drama"
],
"genres": [
{
"personName": "Drama"
}
],
"id": 13894,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/pyarkasaudagar.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/pyarkasaudagar.jpg",
"language": "Hindi",
"name": "Pyar Ka Saudagar",
"productId": 13894,
"productMasterId": 4447,
"productMasterName": "Pyar Ka Saudagar",
"productName": "Pyar Ka Saudagar",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "1961",
"releaseyear": "1961",
"showGoodName": "Movies ",
"views": 1700
},
{
"channelType": "",
"duration": "1:43:18",
"episodeno": 0,
"genre": "Thriller",
"genreList": [
"Thriller"
],
"genres": [
{
"personName": "Thriller"
}
],
"id": 13238,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/sikandar_movie.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/sikandar_movie.jpg",
"language": "Hindi",
"name": "Sikandar",
"productId": 13238,
"productMasterId": 4286,
"productMasterName": "Sikandar",
"productName": "Sikandar",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "2009",
"releaseyear": "2009",
"showGoodName": "Movies ",
"views": 2165
},
{
"channelType": "",
"duration": "1:10:11",
"episodeno": 0,
"genre": "Drama",
"genreList": [
"Drama"
],
"genres": [
{
"personName": "Drama"
}
],
"id": 1260,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/Apoorva%20Ragangal.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/Apoorva%20Ragangal.jpg",
"language": "Tamil",
"name": "Apoorva Ragangal",
"productId": 1260,
"productMasterId": 1259,
"productMasterName": "Apoorva Ragangal",
"productName": "Apoorva Ragangal",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "1975",
"releaseyear": "1975",
"showGoodName": "Movies ",
"views": 12906
},
{
"channelType": "",
"duration": "2:21:00",
"episodeno": 0,
"genre": "Drama",
"genreList": [
"Drama"
],
"genres": [
{
"personName": "Drama"
}
],
"id": 1255,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/Guna.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/Guna.jpg",
"language": "Tamil",
"name": "Guna",
"productId": 1255,
"productMasterId": 989,
"productMasterName": "Guna",
"productName": "Guna",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "2003",
"releaseyear": "2003",
"showGoodName": "Movies ",
"views": 5498
},
{
"channelType": "",
"duration": "2:01:48",
"episodeno": 0,
"genre": "Drama",
"genreList": [
"Drama"
],
"genres": [
{
"personName": "Drama"
}
],
"id": 1247,
"imageUrl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/Mouna-Ragam_58.jpg",
"imageurl": "http://vodimages.bigflicks.com/images/vod/movies/160X100/Mouna-Ragam_58.jpg",
"language": "Tamil",
"name": "Mouna Ragam",
"productId": 1247,
"productMasterId": 1246,
"productMasterName": "Mouna Ragam",
"productName": "Mouna Ragam",
"productTypeId": 1,
"productTypeName": "Movie",
"rating": 3,
"releaseYear": "1986",
"releaseyear": "1986",
"showGoodName": "Movies ",
"views": 10833
}
],
"resultSize": 1171,
"pageIndex": "1"
}
]
My classes are given below -
class basicgalary
{
public Items resultList
{
get;
set;
}
}
public class Items
{
public string id
{
get;
set;
}
public string imageUrl
{
get;
set;
}
public string imageurl
{
get;
set;
}
public string language
{
get;
set;
}
public string name
{
get;
set;
}
public string productid
{
get;
set;
}
public string productMasterId
{
get;
set;
}
public int rating
{
get;
set;
}
public string releaseYear
{
get;
set;
}
public string releaseyear
{
get;
set;
}
public string showGoodName
{
get;
set;
}
public string views
{
get;
set;
}
}
public class common
{
public string personname
{
get;
set;
}
}
I tried so much.. but I am not getting the answer that I want.. So please help me....
I'd also recommend use Json.Net. It's pretty powerful and easy to use.
Json.Net
The .NET Framework provides the JavaScriptSerializer Class which is easy to use (in the System.Web.Extensions.dll assembly).
There is an example here: Dictionary to JSON Serialization and Deserialization
You can use JavaScriptConvert.DeserializeObject()
. For detailed procedure read this.
精彩评论