Hi
I have created below classes for APi response data. But when i try to root.shipmentdata it is not showing
RootShipment root = JsonConvert.DeserializeObject(response.Content);
root.data.
************************
public class RootShipment
{
public bool status { get; set; }
public Data data { get; set; }
}
public class DataShipment
{
public int order_id { get; set; }
public int shipment_id { get; set; }
public string awb_number { get; set; }
public string courier_id { get; set; }
public string courier_name { get; set; }
public string status { get; set; }
public string additional_info { get; set; }
public string payment_type { get; set; }
public string label { get; set; }
}
Thanks
Amit MohantyPosted Jan 11, 2023, 4:58 AM
You have to declare RootShipment class as below
Uday DodiyaPosted Jan 11, 2023, 5:26 AM
Your subclass is DataShipment, but in your RootShipment class you define the Data class, so you have to mention that class as a DataShipment instead of Data, as per below.
Pasang TamangPosted Jan 11, 2023, 4:33 AM
Hi,
As per your class structure public Data data { get; set; } should be public DataShipment data { get; set; }.
This is how your class should be
Regards,
Pasang