c# Spotify API not returning correctly.
-
Good morning all, been writing a little program that when you put a spotify playlist id in it will get the whole playlist want the name and total songs in the playlist mainly so all songs in the playlist and then total count of all songs with a bit of hard work managed to get it to deserialize the content but cant seem to get it to return that what i have currently is this, so it goes though and get as far as here, json data returned from spotify api put it in pastebin link as contains a lot of data then thought i would use json2c# to create my structure for me, and have this in a playlist.cs
using System;
using System.Collections.Generic;
using System.Text;namespace Dark_Admin_Panel.Model
{
public class Playlist
{
// Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse);
public class AddedBy
{
public ExternalUrls external_urls { get; set; }
public string href { get; set; }
public string id { get; set; }
public string type { get; set; }
public string uri { get; set; }
}public class Album { public string album\_type { get; set; } public List artists { get; set; } public List available\_markets { get; set; } public ExternalUrls external\_urls { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public string release\_date { get; set; } public string release\_date\_precision { get; set; } public int total\_tracks { get; set; } public string type { get; set; } public string uri { get; set; } } public class Artist { public ExternalUrls external\_urls { get; set; } public string href { get; set; } public string id { get; set; } public string name { get; set; } public string type { get; set; } public string uri { get; set; } } public class ExternalIds { public string isrc { get; set; } } public class ExternalUrls { public string spotify { get; set; } } public class Followers
-
Good morning all, been writing a little program that when you put a spotify playlist id in it will get the whole playlist want the name and total songs in the playlist mainly so all songs in the playlist and then total count of all songs with a bit of hard work managed to get it to deserialize the content but cant seem to get it to return that what i have currently is this, so it goes though and get as far as here, json data returned from spotify api put it in pastebin link as contains a lot of data then thought i would use json2c# to create my structure for me, and have this in a playlist.cs
using System;
using System.Collections.Generic;
using System.Text;namespace Dark_Admin_Panel.Model
{
public class Playlist
{
// Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse);
public class AddedBy
{
public ExternalUrls external_urls { get; set; }
public string href { get; set; }
public string id { get; set; }
public string type { get; set; }
public string uri { get; set; }
}public class Album { public string album\_type { get; set; } public List artists { get; set; } public List available\_markets { get; set; } public ExternalUrls external\_urls { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public string release\_date { get; set; } public string release\_date\_precision { get; set; } public int total\_tracks { get; set; } public string type { get; set; } public string uri { get; set; } } public class Artist { public ExternalUrls external\_urls { get; set; } public string href { get; set; } public string id { get; set; } public string name { get; set; } public string type { get; set; } public string uri { get; set; } } public class ExternalIds { public string isrc { get; set; } } public class ExternalUrls { public string spotify { get; set; } } public class Followers
You have asked this in a forum dedicated to WPF. Your post has nothing to do with this. You should ask this in Q&A.
-
Good morning all, been writing a little program that when you put a spotify playlist id in it will get the whole playlist want the name and total songs in the playlist mainly so all songs in the playlist and then total count of all songs with a bit of hard work managed to get it to deserialize the content but cant seem to get it to return that what i have currently is this, so it goes though and get as far as here, json data returned from spotify api put it in pastebin link as contains a lot of data then thought i would use json2c# to create my structure for me, and have this in a playlist.cs
using System;
using System.Collections.Generic;
using System.Text;namespace Dark_Admin_Panel.Model
{
public class Playlist
{
// Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse);
public class AddedBy
{
public ExternalUrls external_urls { get; set; }
public string href { get; set; }
public string id { get; set; }
public string type { get; set; }
public string uri { get; set; }
}public class Album { public string album\_type { get; set; } public List artists { get; set; } public List available\_markets { get; set; } public ExternalUrls external\_urls { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public string release\_date { get; set; } public string release\_date\_precision { get; set; } public int total\_tracks { get; set; } public string type { get; set; } public string uri { get; set; } } public class Artist { public ExternalUrls external\_urls { get; set; } public string href { get; set; } public string id { get; set; } public string name { get; set; } public string type { get; set; } public string uri { get; set; } } public class ExternalIds { public string isrc { get; set; } } public class ExternalUrls { public string spotify { get; set; } } public class Followers
elfenliedtopfan5 wrote:
what i am doing wrong
Perhaps something is eating an exception? Not clear how you determined that the response content is valid json. You can also experiment (test) by populating everything in your json objects. Then serialize them to a string. Output that (so you have an example) then deserialize the same thing.