我正在尝试DeserializeObject
,但我收到错误:
无法反序列化当前的JSON,因为该类型需要JSON数组
我认为问题在于,它始于{而不是[,[后来......
我不知道如何向下钻取所有对象从[。
开始的位置这就是我反序列化的方式:
var deserialized = JsonConvert.DeserializeObject<List<NewMovies>>(responseData);
foreach (var item in deserialized)
{
MovieList.Items.Add(item);
}
这就是JSON objekt的样子:
{
"dates": {
"minimum": "2015-09-23",
"maximum": "2015-10-14"
},
"page": 1,
"results": [
{
"adult": false,
"backdrop_path": "/psiy30cJJDohdTciC4mzqjXQhWk.jpg",
"genre_ids": [
28,
12,
878
],
"id": 286217,
"original_language": "en",
"original_title": "The Martian",
"overview": "During a manned mission to Mars, Astronaut Mark Watney is presumed dead after a fierce storm and left behind by his crew. But Watney has survived and finds himself stranded and alone on the hostile planet. With only meager supplies, he must draw upon his ingenuity, wit and spirit to subsist and find a way to signal to Earth that he is alive.",
"release_date": "2015-10-02",
"poster_path": "/AjbENYG3b8lhYSkdrWwlhVLRPKR.jpg",
"popularity": 3.388094,
"title": "The Martian",
"video": false,
"vote_average": 6.6,
"vote_count": 25
},
{
"adult": false,
"backdrop_path": "/xdLTJSjRU2c001amJwj3yNtsp1i.jpg",
"genre_ids": [
53,
12,
18
],
"id": 253412,
"original_language": "en",
"original_title": "Everest",
"overview": "Inspired by the incredible events surrounding a treacherous attempt to reach the summit of the world's highest mountain, \"Everest\" documents the awe-inspiring journey of two different expeditions challenged beyond their limits by one of the fiercest snowstorms ever encountered by mankind. Their mettle tested by the harshest of elements found on the planet, the climbers will face nearly impossible obstacles as a lifelong obsession becomes a breathtaking struggle for survival.",
"release_date": "2015-09-25",
"poster_path": "/t3ELL46AnqjS9djz1vEVh4MpKv0.jpg",
"popularity": 4.322085,
"title": "Everest",
"video": false,
"vote_average": 5.1,
"vote_count": 24
},
{
"adult": false,
"backdrop_path": "/pAJNYRqjEOkqWALfiUkc08W5KfV.jpg",
"genre_ids": [
35,
16
],
"id": 159824,
"original_language": "en",
"original_title": "Hotel Transylvania 2",
"overview": "When the old-old-old-fashioned vampire Vlad arrives at the hotel for an impromptu family get-together, Hotel Transylvania is in for a collision of supernatural old-school and modern day cool.",
"release_date": "2015-09-25",
"poster_path": "/5BGjNYVHWynVNIbo3eF6XhPeB1J.jpg",
"popularity": 3.47324,
"title": "Hotel Transylvania 2",
"video": false,
"vote_average": 7.1,
"vote_count": 50
},
{
"adult": false,
"backdrop_path": "/rRT8eTougmCkqmRE9oESKahfO9X.jpg",
"genre_ids": [
35
],
"id": 257211,
"original_language": "en",
"original_title": "The Intern",
"overview": "70-year-old widower Ben Whittaker has discovered that retirement isn't all it's cracked up to be. Seizing an opportunity to get back in the game, he becomes a senior intern at an online fashion site, founded and run by Jules Ostin.",
"release_date": "2015-09-23",
"poster_path": "/vQ7oVX2j7BnMDYyzuFeG1epqvGb.jpg",
"popularity": 1.355989,
"title": "The Intern",
"video": false,
"vote_average": 3.8,
"vote_count": 8
},
{
"adult": false,
"backdrop_path": "/e63pIZVhdSkx1XEWBkOsbEek1Gt.jpg",
"genre_ids": [
18
],
"id": 285783,
"original_language": "en",
"original_title": "The Walk",
"overview": "The story of French high-wire artist Philippe Petit's attempt to cross the Twin Towers of the World Trade Center in 1974.",
"release_date": "2015-10-02",
"poster_path": "/fjWWAhzJvIkhZHAjberkD6xdWiq.jpg",
"popularity": 1.200875,
"title": "The Walk",
"video": false,
"vote_average": 4.5,
"vote_count": 3
},
{
"adult": false,
"backdrop_path": "/gJduaRau3X2oE3xkmjs1FufT2GE.jpg",
"genre_ids": [
27,
53
],
"id": 263472,
"original_language": "en",
"original_title": "Knock Knock",
"overview": "Two young women show up at the home of a married man and begin to systematically destroy his idyllic life.",
"release_date": "2015-10-09",
"poster_path": "/eynMtjBB1fXsB5vsQylVmsDLmvw.jpg",
"popularity": 1.105561,
"title": "Knock Knock",
"video": false,
"vote_average": 5.7,
"vote_count": 13
},
{
"adult": false,
"backdrop_path": "/4oo8ZgpDa2JpwSXfTz3XQ2A51wQ.jpg",
"genre_ids": [
53,
28
],
"id": 359471,
"original_language": "en",
"original_title": "Swat: Unit 887",
"overview": "A non-stop, race against time action packed thriller that follows an elite SWAT Team as they try to stop a domestic terrorist from killing innocent hostages and destroying the city of Los Angeles. With 24 hours left on the clock, the team must rely on their instincts and unique skill set to stop the attack and bring justice.",
"release_date": "2015-09-29",
"poster_path": "/edsNNRw57Wq1V9g0ocsHeebkcbL.jpg",
"popularity": 2.00704,
"title": "Swat: Unit 887",
"video": false,
"vote_average": 0,
"vote_count": 0
},
{
"adult": false,
"backdrop_path": "/jULYq1OBQMgZKToXmeGiQa5SAWE.jpg",
"genre_ids": [
10749,
35,
18
],
"id": 330112,
"original_language": "en",
"original_title": "Ashby",
"overview": "High-school student Ed Wallis enters into a friendship with his neighbor, Ashby, a retired CIA assassin who only has a few months left to live.",
"release_date": "2015-09-25",
"poster_path": "/5bBydg6eod3cvYahKiAgAvbo3nV.jpg",
"popularity": 1.717224,
"title": "Ashby",
"video": false,
"vote_average": 3.2,
"vote_count": 9
},
{
"adult": false,
"backdrop_path": "/lHldAGMjOSBAV2QuGhuqaTBXvnE.jpg",
"genre_ids": [
27,
53
],
"id": 171424,
"original_language": "en",
"original_title": "The Green Inferno",
"overview": "Student activists from New York City travel to the remote jungles of Peru in order to stage a protest but instead encounter a tribe of cannibals.",
"release_date": "2015-09-25",
"poster_path": "/prG32jWEgiZ2N8BpBPu1G0jMiv2.jpg",
"popularity": 1.924986,
"title": "The Green Inferno",
"video": false,
"vote_average": 4.6,
"vote_count": 14
},
{
"adult": false,
"backdrop_path": "/wvp4MMK6XoStQkrumSlpzGeOxoy.jpg",
"genre_ids": [
36,
18
],
"id": 321697,
"original_language": "en",
"original_title": "Steve Jobs",
"overview": "Set backstage at three iconic product launches and ending in 1998 with the unveiling of the iMac, Steve Jobs takes us behind the scenes of the digital revolution to paint an intimate portrait of the brilliant man at its epicenter.",
"release_date": "2015-10-09",
"poster_path": "/7SUaf2UgoY0ZRGbQtRlfDkLDBCb.jpg",
"popularity": 1.831722,
"title": "Steve Jobs",
"video": false,
"vote_average": 5,
"vote_count": 3
},
{
"adult": false,
"backdrop_path": "/6Ym6bgfhvpgQS5Sg8kKnfW1hX7P.jpg",
"genre_ids": [
14,
12
],
"id": 266647,
"original_language": "en",
"original_title": "Pan",
"overview": "The story of an orphan who is spirited away to the magical Neverland. There, he finds both fun and dangers, and ultimately discovers his destiny -- to become the hero who will be forever known as Peter Pan.",
"release_date": "2015-10-09",
"poster_path": "/nCzDROwv4553IMpz9cJffrjRP8f.jpg",
"popularity": 1.716557,
"title": "Pan",
"video": false,
"vote_average": 4.4,
"vote_count": 12
},
{
"adult": false,
"backdrop_path": "/thaDwt0Q0ttt0x7PyR6ZKvtgmom.jpg",
"genre_ids": [
27,
53
],
"id": 301804,
"original_language": "en",
"original_title": "Before I Wake",
"overview": "Before I Wake is a haunting, emotionally absorbing supernatural thriller about an orphaned child whose dreams - and nightmares - manifest physically as he sleeps.",
"release_date": "2015-09-25",
"poster_path": "/ugTQKNYyAW9BZiyy0EKlKD0gtx1.jpg",
"popularity": 0.616081,
"title": "Before I Wake",
"video": false,
"vote_average": 0,
"vote_count": 0
},
{
"adult": false,
"backdrop_path": "/zIGKRyNKWvnNsmvAkgGjjMoKsMG.jpg",
"genre_ids": [
18
],
"id": 283235,
"original_language": "en",
"original_title": "99 Homes",
"overview": "After his family is evicted from their home, proud and desperate construction worker Dennis Nash tries to win his home back by striking a deal with the devil and working for Rick Carver, the corrupt real estate broker who evicted him.",
"release_date": "2015-09-25",
"poster_path": "/mw4b2KLWInQ3Po5uOOTU6Q0Y5VP.jpg",
"popularity": 0.566387,
"title": "99 Homes",
"video": false,
"vote_average": 0,
"vote_count": 0
},
{
"adult": false,
"backdrop_path": "/hny5Jo6B9eG8Cp6Q1D3w5wPzgt3.jpg",
"genre_ids": [
18
],
"id": 284284,
"original_language": "en",
"original_title": "The Keeping Room",
"overview": "Three Southern women - two sisters and one African American slave - left without men in the dying days of the Civil War, are forced to defend their home from the onslaught of a band of soldiers who have broken off from the fast approaching Union Army.",
"release_date": "2015-09-25",
"poster_path": "/phpx2Gv4H4bb8HF5ep1rFEgkDBu.jpg",
"popularity": 1.377608,
"title": "The Keeping Room",
"video": false,
"vote_average": 0.8,
"vote_count": 2
},
{
"adult": false,
"backdrop_path": "/wg7O6XKeNdZZeTeyhZtVV19s2uG.jpg",
"genre_ids": [
10749,
18
],
"id": 306745,
"original_language": "en",
"original_title": "Freeheld",
"overview": "New Jersey car mechanic Stacie Andree and her police detective girlfriend Laurel Hester both battle to secure Hester's pension benefits after she was diagnosed with a terminal illness.",
"release_date": "2015-10-02",
"poster_path": "/8MBjR9wzBIJiiTFgC5XGBgcQvL2.jpg",
"popularity": 1.477729,
"title": "Freeheld",
"video": false,
"vote_average": 0,
"vote_count": 0
},
{
"adult": false,
"backdrop_path": "/iiR2DXgJrv7v1v6hXoDCBTmbPDR.jpg",
"genre_ids": [
16,
10402
],
"id": 349158,
"original_language": "en",
"original_title": "My Little Pony: Equestria Girls - Friendship Games",
"overview": "Canterlot High meets its rival school, Crystal Prep Academy, in a competition that’s a long-standing tradition – The Friendship Games. Sunset Shimmer is tasked with keeping magic out of the games to avoid the appearance of impropriety while she and her friends compete against Crystal Prep’s top students led by someone with an equal amount of interest in Equestrian magic – this world’s TWILIGHT SPARKLE.",
"release_date": "2015-09-26",
"poster_path": "/zLwpkIK1PM1xG5PMKK7CEsm8HMA.jpg",
"popularity": 1.893976,
"title": "My Little Pony: Equestria Girls - Friendship Games",
"video": false,
"vote_average": 10,
"vote_count": 2
},
{
"adult": false,
"backdrop_path": null,
"genre_ids": [
53,
35,
18
],
"id": 298382,
"original_language": "en",
"original_title": "The Dressmaker",
"overview": "A glamorous woman returns to her small town in rural Australia. With her sewing machine and haute couture style, she transforms the women and exacts sweet revenge on those who did her wrong.",
"release_date": "2015-10-01",
"poster_path": "/zuT8CFsdZTnUM7DW1VMbwvlkS4O.jpg",
"popularity": 1.426732,
"title": "The Dressmaker",
"video": false,
"vote_average": 0,
"vote_count": 0
},
{
"adult": false,
"backdrop_path": null,
"genre_ids": [
53
],
"id": 241258,
"original_language": "en",
"original_title": "Incarnate",
"overview": "An exorcist comes up against an evil from his past when he uses his skills to enter the mind of a nine year old boy.",
"release_date": "2015-09-23",
"poster_path": null,
"popularity": 1.346483,
"title": "Incarnate",
"video": false,
"vote_average": 0,
"vote_count": 0
},
{
"adult": false,
"backdrop_path": null,
"genre_ids": [],
"id": 356318,
"original_language": "en",
"original_title": "North Mountain",
"overview": "Wolf, a young métis hunter living on the mountain. While hunting deep in the woods he discovers Crane, an older man with a mysterious past and the scars to prove it. Wolf nurses him back to health. Over time their bond gets deeper and they fall in love. When outsiders begin to show up looking for Crane, blood begins to flow. Cornered by an army of crooked cops, Wolf and Crane work together to boobie trap the mountain, taking them out one at a time until they come face-to-face with the man who pulls the strings…. Bretten Hannam’s debut feature is an ambitious action/thriller with outstanding performances from Justin Rain (Defiance) and Festival favourite Glen Gould (Rhymes for Young Ghouls, Charlie Zone).",
"release_date": "2015-09-23",
"poster_path": null,
"popularity": 1.294467,
"title": "North Mountain",
"video": false,
"vote_average": 0,
"vote_count": 0
},
{
"adult": false,
"backdrop_path": "/hCUo3amS2hXL92AK4hSFKVljxjC.jpg",
"genre_ids": [
99,
10402
],
"id": 348960,
"original_language": "en",
"original_title": "The Reflektor Tapes",
"overview": "Arcade Fire’s first feature film is called 'The Reflektor Tapes'. The project is “a unique cinematic experience, meeting at the crossroads of documentary, music, art and personal history.”",
"release_date": "2015-09-24",
"poster_path": "/w7VJwfPGTPMrAW3804HYJzY56U3.jpg",
"popularity": 1.417043,
"title": "The Reflektor Tapes",
"video": false,
"vote_average": 0,
"vote_count": 0
}
],
"total_pages": 10,
"total_results": 189
}
NewMovies类:
class NewMovies
{
public bool adult { get; set; }
public string backdrop_path { get; set; }
public List<object> genre_ids { get; set; }
public int id { get; set; }
public string original_language { get; set; }
public string original_title { get; set; }
public string overview { get; set; }
public string release_date { get; set; }
public string poster_path { get; set; }
public double popularity { get; set; }
public string title { get; set; }
public bool video { get; set; }
public double vote_average { get; set; }
public int vote_count { get; set; }
}