Dealing with Nested Json

CaliphCaliph Member ✭✭

Hi Guys
I want to get nested Json and bind them in ListView
this is my Property Class

public class Items
    {
        public Image  image { get; set; }
        public Artist artist { get; set; }
    }


    public class Rootobject
    {
        public Tracks tracks { get; set; }
    }

    public class Tracks
    {
        public Track[] track { get; set; }
        public Attr attr { get; set; }
    }

    public class Attr
    {
        public string page { get; set; }
        public string perPage { get; set; }
        public string totalPages { get; set; }
        public string total { get; set; }
    }

    public class Track
    {
        public string name { get; set; }
        public string duration { get; set; }
        public string playcount { get; set; }
        public string listeners { get; set; }
        public string mbid { get; set; }
        public string url { get; set; }
        public Streamable streamable { get; set; }
        public Artist artist { get; set; }
        public Image[] image { get; set; }
    }

    public class Streamable
    {
        public string text { get; set; }
        public string fulltrack { get; set; }
    }



    public class Image
    {
        public string text { get; set; }
        public string size { get; set; }
    }

    public class Artist
    {
        public string name { get; set; }
        public string mbid { get; set; }
        public string url { get; set; }
    }        

and this is my Method but it is not working in nested Json

                    _activityIndicator.IsRunning = true;
                            var uri = new Uri(*******************************2601aab9e9d71ef262de7d9d6&format=json");
                            var client = new HttpClient();
                            var content = await client.GetStringAsync(uri);
                            string a = content.ToString();
                            var tr = JsonConvert.DeserializeObject<List<Items>>(a);
                            ObservableCollection<Items> ob = new ObservableCollection<Items>(tr);
                            lister.ItemsSource = ob;

        as always forgive about bad English :smile: 
Sign In or Register to comment.