2
Answers

Json to List view Conversion retriving null values in xmaria

1. Am tryting to convert Json data to list but its showing null. my code and json data like below.But in the list (lst) it showing null.
json:
 {"Data":[{"LocationId":6,"LocationName":"abc","ServiceUrl":"www.google.com", },{"LocationId":3,"LocationName":"abcd","ServiceUrl":"192.168.0.110/IKLT/service.svc"}],"ErrorCode":"201 - Success","Message":"Success","Status":true}
classes: 
public class GetLocationResult
{
public string Status { get; set; }
public List Data { get; set; }
public string Message { get; set; }
public string ErrorCode { get; set; }
}
public class LocationDetails
{
public int LocationId { get; set; }
public string LocationName { get; set; }
public string ServiceUrl { get; set; }
}
 Convrsion:
GetLocationResult lst= JsonConvert.DeserializeObject(result);
 
 
 
 GetLocationResult  lr = (GetLocationResult)JsonConvert.DeserializeObject(result, typeof(GetLocationResult)); 
Answers (2)