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 AnsariRank #326 · 7.6K reputationPosted Jan 27, 2022, 3:08 AM EST
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; }
}
Sachin SinghRank #66 · 26.2K reputationPosted Jan 26, 2022, 11:53 PM EST
aa ff30 reputationPosted Jan 27, 2022, 1:12 AM EST
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"
}]
aa ff30 reputationPosted Jan 27, 2022, 4:03 AM EST
@muhammad imran ansari, i've changed the class structure and json data, but still it returning null
Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Jan 27, 2022, 4:11 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Jan 27, 2022, 6:28 AM EST
aa ff30 reputationPosted Jan 28, 2022, 1:32 AM EST