I have a problem on deserializing json. Currently, the data returns null after deserializing.
Below is the classes that I have created for binding Json.

the function for deserializing json data is in the deserialize.zip file.
What is the issue with my code? Anything wrong with my code?
Muhammad Imran AnsariPosted Jan 27, 2022, 8:08 AM
There is some issue in Json data and in class structure, class location is being used as class and object name. Use the following Class structure and json:
data { get; set; } Location { get; set; }
Json:
{
"data": [
{
"tracking_number": "AQK225225",
"pickup_place": "India",
"delivery_place": "London",
"tel_no": "+35256676452",
"status": "pickup",
"lastupdate_time": "2022-01-27T13:02:24.0356139+05:00",
"Location": [
{
"location": "MTS Pvt. Ltd",
"remarks": "",
"deliverydate": "12/12/2018",
"pickupdate": "04/10/2018"
}
]
}
]
}
Class Structure:
public class Tracking
{
public string Message { get; set; }
public string TokenAccess { get; set; }
public List
}
public class Datum
{
public string tracking_number { get; set; }
public string pickup_place { get; set; }
public string delivery_place { get; set; }
public string tel_no { get; set; }
public string status { get; set; }
public DateTime lastupdate_time { get; set; }
public List
}
public class Location
{
public string location { get; set; }
public string remarks { get; set; }
public string deliverydate { get; set; }
public string pickupdate { get; set; }
}
aa ffPosted Jan 28, 2022, 6:32 AM
Sachin SinghPosted Jan 27, 2022, 11:28 AM
Muhammad Imran AnsariPosted Jan 27, 2022, 9:11 AM
aa ffPosted Jan 27, 2022, 9:03 AM
@muhammad imran ansari, i've changed the class structure and json data, but still it returning null
aa ffPosted Jan 27, 2022, 6:12 AM
Here is the json data:
"data": [
{
"tracking_number": "AQK225225",
"pickup_place": "India",
"delivery_place": "London",
"tel_no": "+35256676452",
"status": "pickup",
"lastupdate_time": "2018-10-12T23:01:00.000+05:30"
"location": [
{
"location": "MTS Pvt. Ltd",
"remarks": "",
"deliverydate": "12/12/2018"
"pickupdate": "04/10/2018"
}]
Sachin SinghPosted Jan 27, 2022, 4:53 AM