Fail to deserialization a JSON

May 7, 2012 at 3:14 PM
Edited May 7, 2012 at 3:24 PM

I try to deserialization a JSON like the following  in a windows phone 7 application l(Numbers like 93817 and 935812 are dynamically generated from a server. Can't be hard coded.):

{   "status":"1",               
"list":{      
 
"93817":{         "item_id":"93817",        
                   
"url":"http://url.com",        
                   
"title":"Page Title",        
                   
"time_updated":"1245626956",                
                   
"time_added":"1245626956",                
                   
"tags":"comma,seperated,list",        
                   
"state":"0"                      
         
},      
 
"935812":{         "item_id":"935812",        
                   
"url":"http://google.com",        
                   
"title":"Google",        
                   
"time_updated":"1245626956",      
                   
"time_added":"1245626956",      
                   
"tags":"comma,seperated,list",        
                   
"state":"1"                    
 
}   }}    

Here is the code for deserialization:

 

responseGetList = e.Result.ToString();   //JSON string            

ResponseItem ri = new ResponseItem();             

  ri = JsonConvert.DeserializeObject(responseGetList);

 

And the following is the ResponseItem class:

 

namespace whatever
{

    public class ResponseItem
    {

        string status;
        public string Status
        {
            get { return status; }
            set { status = value; }
        }

        List list;

        private List List
        {
            get { return list; }
            set { list = value; }
        }


    }
    public class ListItem
    {

        Article listArticle;

        public Article ListArticle
        {
            get { return listArticle; }
            set { listArticle = value; }
        }
    }


    public class Article
    {

        string item_id;

        public string Item_id
        {
            get { return item_id; }
            set { item_id = value; }
        }

        string url;

        public string Url
        {
            get { return url; }
            set { url = value; }
        }



        string title;

        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        string time_updated;

        public string Time_updated
        {
            get { return time_updated; }
            set { time_updated = value; }
        }

        string time_added;

        public string Time_added
        {
            get { return time_added; }
            set { time_added = value; }
        }

        string tags;

        public string Tags
        {
            get { return tags; }
            set { tags = value; }
        }

        string state;

        public string State
        {
            get { return state; }
            set { state = value; }
        }

    }
}

 

I successfully got the object but its list is null. I don't know how to generate the dynamical properties like "93817". Any ideas about how to deal with them?