c# - How to solve hard issue about Cannot deserialize the current (eg {“name”:“value”}) by using newtonsoft json -
the classes:
public class trackspotify { public class externalurls { public string spotify { get; set; } } public class image { public int height { get; set; } public string url { get; set; } public int width { get; set; } } public class item { public string album_type { get; set; } public list<string> available_markets { get; set; } public externalurls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public list<image> images { get; set; } public string name { get; set; } public string type { get; set; } public string uri { get; set; } } public class albums { public string href { get; set; } public list<item> items { get; set; } public int limit { get; set; } public string next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class rootobject { public albums albums { get; set; } } }
the json string
{ "albums" : { "href" : "https://api.spotify.com/v1/browse/new-releases?offset=0&limit=20", "items" : [ { "album_type" : "single", "available_markets" : [ "ad", "ar", "at", "au", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "es", "fr", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "mc", "mt", "mx", "my", "ni", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "sg", "si", "sk", "sv", "tr", "tw", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/60mvultyinsrmpvvoa3re4" }, "href" : "https://api.spotify.com/v1/albums/60mvultyinsrmpvvoa3re4", "id" : "60mvultyinsrmpvvoa3re4", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/8642802d13a53541e313781c34521a0d33099aac", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/631ee4d5160303af86751587457b1b00957e0519", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/d7b7140400d985d1294d7b044da1b5b4bfc0ae69", "width" : 64 } ], "name" : "we 1 (ole ola) [the official 2014 fifa world cup song]", "type" : "album", "uri" : "spotify:album:60mvultyinsrmpvvoa3re4" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/4jxziywnlxm4opw34pmjvj" }, "href" : "https://api.spotify.com/v1/albums/4jxziywnlxm4opw34pmjvj", "id" : "4jxziywnlxm4opw34pmjvj", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/47c6249a3d514752fc783e64a2f47611bce66a4b", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/a22dbdd2595f1144890eb269bb93cc79142f2767", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/c1bd45015d6a1245603a88e03d336992f5d653a2", "width" : 64 } ], "name" : "a13", "type" : "album", "uri" : "spotify:album:4jxziywnlxm4opw34pmjvj" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "au", "be", "bg", "bo", "br", "ca", "cl", "co", "cr", "cy", "cz", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/1siplwzu1r69coxkmh06kw" }, "href" : "https://api.spotify.com/v1/albums/1siplwzu1r69coxkmh06kw", "id" : "1siplwzu1r69coxkmh06kw", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/c65ef9bb11bcd9d06aa710866fb3440291c5f9ea", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/8db5eeba539b7eabe7599e13e7bd83b8ec9f98bb", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/abfb50b9844def2e40afac4059da71d658845ab2", "width" : 64 } ], "name" : "may death never stop you", "type" : "album", "uri" : "spotify:album:1siplwzu1r69coxkmh06kw" }, { "album_type" : "single", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/5qznaz5xjcuaiyyoetu0aj" }, "href" : "https://api.spotify.com/v1/albums/5qznaz5xjcuaiyyoetu0aj", "id" : "5qznaz5xjcuaiyyoetu0aj", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/86c15f11c44726c52df044882e39e6c4d168f8a8", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/f7e52154d6ea994ea9e78dd8b1ab0d37417934ef", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/2a5c218cb7e524c5bd95b938b3553905311705da", "width" : 64 } ], "name" : "keep watch", "type" : "album", "uri" : "spotify:album:5qznaz5xjcuaiyyoetu0aj" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/5zzfff7wsmmgaiwjahelnw" }, "href" : "https://api.spotify.com/v1/albums/5zzfff7wsmmgaiwjahelnw", "id" : "5zzfff7wsmmgaiwjahelnw", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/aa1d1cf0d70fb29b4ae575f10d2ac8acc88413f5", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/aed60ab4e13c6cd781df8dcd2375c2b186ae1991", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/058e4170c906814ee70fb51ae1d84d09d5244979", "width" : 64 } ], "name" : "by means", "type" : "album", "uri" : "spotify:album:5zzfff7wsmmgaiwjahelnw" }, { "album_type" : "single", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/0lkhtm8yojh9yggm8dwv40" }, "href" : "https://api.spotify.com/v1/albums/0lkhtm8yojh9yggm8dwv40", "id" : "0lkhtm8yojh9yggm8dwv40", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/6b2eea62c1a6f986824e25ff4e0f072c515a9988", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/f9a46fb4f6f4ca0117c2d1ab530a36958921720b", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/06e3464983b24b9957828d10b6c2a34c6dddae9c", "width" : 64 } ], "name" : "depth of soul (feat. shana halligan)", "type" : "album", "uri" : "spotify:album:0lkhtm8yojh9yggm8dwv40" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/1dkh4z5aayt8ffdwjo5fdh" }, "href" : "https://api.spotify.com/v1/albums/1dkh4z5aayt8ffdwjo5fdh", "id" : "1dkh4z5aayt8ffdwjo5fdh", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/b2602ba2bd35dca1cc2903d58429a9379b342bf3", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/8b86d8c65c01dacc92305003559db960e36a9614", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/3eb58e564cc6ede9ac234c293e905e166cefa1b2", "width" : 64 } ], "name" : "singles", "type" : "album", "uri" : "spotify:album:1dkh4z5aayt8ffdwjo5fdh" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/33juyjox4j6bwj7vkzwoth" }, "href" : "https://api.spotify.com/v1/albums/33juyjox4j6bwj7vkzwoth", "id" : "33juyjox4j6bwj7vkzwoth", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/e35451b38b162c4a8665b77e729c53a2437d6f74", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/f5baa64ff1928f27163516658b8301b92e54c80a", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/41f4c456d66bc81d4e10d502d707fb778c431798", "width" : 64 } ], "name" : "out among stars", "type" : "album", "uri" : "spotify:album:33juyjox4j6bwj7vkzwoth" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/4ke1w1zgp6ag6ojbuxzk7l" }, "href" : "https://api.spotify.com/v1/albums/4ke1w1zgp6ag6ojbuxzk7l", "id" : "4ke1w1zgp6ag6ojbuxzk7l", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/c9eca97fd2817f349737dfe2aa672929759a556b", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/b131664fc60fc781b5bfe41a41763d4176abfdcb", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/5d2a8eeb9732f68c09c8c582ee5d028091fe1abf", "width" : 64 } ], "name" : "underneath rainbow (bonus track version)", "type" : "album", "uri" : "spotify:album:4ke1w1zgp6ag6ojbuxzk7l" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "be", "bg", "bo", "br", "ca", "cl", "co", "cr", "cy", "cz", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/6rcoar93gi157qww771xfg" }, "href" : "https://api.spotify.com/v1/albums/6rcoar93gi157qww771xfg", "id" : "6rcoar93gi157qww771xfg", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/590d34233a0ef309d2c83213fb20cdef7e7804c6", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/5bceabff51f4e0366fa7e05bfc92e3f8a73e157f", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/32d480d47b3f0d0687c7d6cb362f7246b35fb62e", "width" : 64 } ], "name" : "kiss me once (special edition)", "type" : "album", "uri" : "spotify:album:6rcoar93gi157qww771xfg" }, { "album_type" : "single", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/14ghinsb8mh3sonersqp28" }, "href" : "https://api.spotify.com/v1/albums/14ghinsb8mh3sonersqp28", "id" : "14ghinsb8mh3sonersqp28", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/ceabefd7b5c7c1a4a4a550de823289810b14b7dd", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/398e5dda368c86337c8240dd2e6fa015ae576ce2", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/e73d5b0fb22ae7e0ceb66155a7dc82f5512f9005", "width" : 64 } ], "name" : "fallinlove2nite", "type" : "album", "uri" : "spotify:album:14ghinsb8mh3sonersqp28" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/7rf1qzj6hgslpn7k9shsvv" }, "href" : "https://api.spotify.com/v1/albums/7rf1qzj6hgslpn7k9shsvv", "id" : "7rf1qzj6hgslpn7k9shsvv", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/9ab61dfa896d1431af5cddcb2bb9dba471103bb0", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/fd6fe6aa26f835e85fc8b555f2ed86a36d62ca33", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/c00728e445db587f47d8f4161319d83e5b2fe33c", "width" : 64 } ], "name" : "recess", "type" : "album", "uri" : "spotify:album:7rf1qzj6hgslpn7k9shsvv" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/1ypleb0kz4soyt2kblginr" }, "href" : "https://api.spotify.com/v1/albums/1ypleb0kz4soyt2kblginr", "id" : "1ypleb0kz4soyt2kblginr", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/baca3f284d82c0b10286dfdd0727b96b7744caf5", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/f0cea1f04f0a442049aad5047d06a4948752d94e", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/233aafd9f55291c1103ed69b821af3521d4f97ce", "width" : 64 } ], "name" : "love letters", "type" : "album", "uri" : "spotify:album:1ypleb0kz4soyt2kblginr" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/2bqejnigjufugst71hhog3" }, "href" : "https://api.spotify.com/v1/albums/2bqejnigjufugst71hhog3", "id" : "2bqejnigjufugst71hhog3", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/b02ee9ec0e8eade076bc2358cba1e22921de956d", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/1e92081774a2150269dc23ee02bd643c8e5c1bb5", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/113ff50a0e7d0a52de712314e1bf4e66e1460598", "width" : 64 } ], "name" : "the take off , landing of everything", "type" : "album", "uri" : "spotify:album:2bqejnigjufugst71hhog3" }, { "album_type" : "album", "available_markets" : [ "ca", "us" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/13xrsfodll3utg3xsyl8u2" }, "href" : "https://api.spotify.com/v1/albums/13xrsfodll3utg3xsyl8u2", "id" : "13xrsfodll3utg3xsyl8u2", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/2ab5e967f8979027fbe7ae7508aaa216f98ebbd9", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/0b87d1fbca3b4bf8a1df3bff69c49083bc0363ba", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/221626b9dc42c9a8e75d53a277c601824f173c49", "width" : 64 } ], "name" : "no mythologies follow (deluxe)", "type" : "album", "uri" : "spotify:album:13xrsfodll3utg3xsyl8u2" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/7layjiypipbcdvjkobx1tv" }, "href" : "https://api.spotify.com/v1/albums/7layjiypipbcdvjkobx1tv", "id" : "7layjiypipbcdvjkobx1tv", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/915c9f12ef6479d885ae3f6de2dedafb70494d20", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/aba9cf39c84a1444420b230f0e6b851ec4db8f08", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/107b06d55ea161a15a21dec478d5aa1d0befaa40", "width" : 64 } ], "name" : "atlas", "type" : "album", "uri" : "spotify:album:7layjiypipbcdvjkobx1tv" }, { "album_type" : "single", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/4ccffozyo6jc8acn8uip7u" }, "href" : "https://api.spotify.com/v1/albums/4ccffozyo6jc8acn8uip7u", "id" : "4ccffozyo6jc8acn8uip7u", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/95f5cbdb03db43c16046562c5f85cc2e3f77b596", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/c950057b00130fb061e801b45aea6cc45dba1bc3", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/53c5c7fbda7527abb8635e7af36af4e333f01e22", "width" : 64 } ], "name" : "magic", "type" : "album", "uri" : "spotify:album:4ccffozyo6jc8acn8uip7u" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/4jhtctkg5cxjaxyljtkuee" }, "href" : "https://api.spotify.com/v1/albums/4jhtctkg5cxjaxyljtkuee", "id" : "4jhtctkg5cxjaxyljtkuee", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/c61a960d6110e259eb26a8a48d39b5b43b61bcdf", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/e504411141d5dd4742d41245e9821d6da9079bc5", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/b4af49db137f7862cef31d64b4ab9c7f14475467", "width" : 64 } ], "name" : "somebody's party - ep", "type" : "album", "uri" : "spotify:album:4jhtctkg5cxjaxyljtkuee" }, { "album_type" : "album", "available_markets" : [ "ar", "au", "bo", "br", "ca", "cl", "co", "cr", "do", "ec", "gt", "hk", "hn", "mx", "my", "ni", "nz", "pa", "pe", "ph", "py", "sg", "sv", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/0cvy3sh2exfvz8wix68hsz" }, "href" : "https://api.spotify.com/v1/albums/0cvy3sh2exfvz8wix68hsz", "id" : "0cvy3sh2exfvz8wix68hsz", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/3d0b40dbf4ed6318b2bbe87d83a9bcbf39fcc45d", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/bc2bd24632e69303590c47a60c0d3b7e73ad641a", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/79b3b1df664940f0352a7214e1260603124cc590", "width" : 64 } ], "name" : "spotify sessions - live @ warped tour 2013", "type" : "album", "uri" : "spotify:album:0cvy3sh2exfvz8wix68hsz" }, { "album_type" : "album", "available_markets" : [ "ad", "ar", "at", "au", "be", "bg", "bo", "br", "ca", "ch", "cl", "co", "cr", "cy", "cz", "de", "dk", "do", "ec", "ee", "es", "fi", "fr", "gb", "gr", "gt", "hk", "hn", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mc", "mt", "mx", "my", "ni", "nl", "no", "nz", "pa", "pe", "ph", "pl", "pt", "py", "ro", "se", "sg", "si", "sk", "sv", "tr", "tw", "us", "uy" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/5oleew6gik32emhoqrlfgu" }, "href" : "https://api.spotify.com/v1/albums/5oleew6gik32emhoqrlfgu", "id" : "5oleew6gik32emhoqrlfgu", "images" : [ { "height" : 636, "url" : "https://i.scdn.co/image/5211638dd177a7a1266b32c896dc8b42c2b1df42", "width" : 640 }, { "height" : 298, "url" : "https://i.scdn.co/image/428b45010d16b41c53260724d447810199cb3d11", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/a6ee613798ecb589b02339bb5749194e9da3e547", "width" : 64 } ], "name" : "bob dylan - 30th anniversary concert celebration (deluxe edition) [remastered]", "type" : "album", "uri" : "spotify:album:5oleew6gik32emhoqrlfgu" } ], "limit" : 20, "next" : "https://api.spotify.com/v1/browse/new-releases?offset=20&limit=20", "offset" : 0, "previous" : null, "total" : 119 } }
the code
public async system.threading.tasks.task<string> querytrack() { httpclient client = new httpclient(); string url = "https://api.spotify.com/v1/browse/new-releases?client_id=" + api_key + "&country=us&offset=0&limit=20&access_token=....h"; httpresponsemessage response = await client.getasync(url); httpresponsemessage v = new httpresponsemessage(); return await response.content.readasstringasync(); } public async void load() { var query = await querytrack.querytrack(); var arrays = jsonconvert.deserializeobject<list<trackspotify.item>>(query);//errors spotifyitems.itemssource = arrays; }
i trying no results.
other things tried:
list<newreleasespotify.item> arrays = jsonconvert.deserializeobject<list<newreleasespotify.item>>(query); list<newreleasespotify.rootobject> arrays = jsonconvert.deserializeobject<list<newreleasespotify.rootobject>>(query)
with error: cannot deserialize current json object (eg {“name”:“value.....
and
var arrays = jsonconvert.deserializeobject<idictionary<string,newreleasespotify.item>>(query); var arrays = jsonconvert.deserializeobject<newreleasespotify.item>(query);
with: newreleasespotify.rootobject null.
the problem json string represents singular object, can't deserialize collection data type such list<t>
. try deserialize newreleasespotify.rootobject
instead :
var root = jsonconvert.deserializeobject<newreleasespotify.rootobject>(query);
... console.writeline(root.albums.href);
prints https://api.spotify.com/v1/browse/new-releases?offset=0&limit=20
me. see dotnetfiddle demo.
Comments
Post a Comment