asp.net - Unable to get Dictionary key , value in string in C# -


i have code json object in c# object. in req object, have object called numbers. each number has 1 key , 3 values:

  1. date
  2. desc
  3. status

how each number's key , 3 values? want number, date, desc, status fields

http://postimg.org/image/j4x36aotd/

json

{     "requestid": "546b384ce51f469a2e8b4567",     "numbers": {         "917566559950": {             "date": "2014-11-18 17:45:59",             "status": 1,             "desc": "delivered"         }     } } 

c# code

public partial class all_getsmsreeport : system.web.ui.page {     protected void page_load(object sender, eventargs e)     {         string json = "";         if (request.querystring["data"] !="")         {             json = request.querystring["data"];              var req = jsonconvert.deserializeobject<request>(json);             string requestid = req.requestid;          }     }  }  public class smsstatus {     public string date { get; set; }     public int status { get; set; }     public string desc { get; set; } }   public class request {     public string requestid { get; set; }     public dictionary<string, smsstatus> numbers { get; set; } //<-- see line } 

simple forach loop iteration.

foreach (var numberobj in req.numbers)         {             var key = numberobj.key;             var value = numberobj.value;              var status = value.status;             var date = value.date;             var descr = value.desc;         } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -