Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. c# Spotify API not returning correctly.

c# Spotify API not returning correctly.

Scheduled Pinned Locked Moved WPF
jsoncsharpcomannouncement
3 Posts 3 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    elfenliedtopfan5
    wrote on last edited by
    #1

    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
    
    P J 2 Replies Last reply
    0
    • E elfenliedtopfan5

      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
      
      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      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.

      Advanced TypeScript Programming Projects

      1 Reply Last reply
      0
      • E elfenliedtopfan5

        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
        
        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups