Convert json string in object in c#



JsonConvert class has a method to convert to and from JSON string, SerializeObject() and DeserializeObject()

  1. string jsonString= @ "{    'firstName''Rajan''lastName''Singh' } ;  
  2.   
  3. Details  details = JsonConvert.DeserializeObject<Details> (data);    
  4.   
  5. }    
  6.   
  7. public class Details    
  8. {    
  9.     public string firstName {    
  10.         get;    
  11.         set;    
  12.     }    
  13.     public string lastName {    
  14.         get;    
  15.         set;    
  16.     }    
  17. }    

0 Comment's

Comment Form

Submit Comment