我有一个嵌套的JSON,所有的东西都可以,但是有一部分我无法从中获取数据,请查看我的JSON字符串:
我能够提取订单和客户详细信息,但是当涉及到订单项时,我无法从该JSON字符串中获取它,因为它是对象而对象包含数组列表,所以对我的任何建议提取那些数组项
答案 0 :(得分:0)
使用基础对象读取主JSON,然后读取内部JSON项的CustmerDetails
类和ItemDetails
类。
以下是用于读取数据的类:
public class BaseObject
{
public string mobileapp_request_id { get; set; }
public string CustmerDetails { get; set; }
public string PaymentMethodID { get; set; }
public string Method { get; set; }
public string brand_id { get; set; }
public string specialrequest { get; set; }
public string ItemDetails { get; set; }
public string TotalPrice { get; set; }
}
public class CustmerDetails
{
public string country_id { get; set; }
public string block { get; set; }
public string apartment { get; set; }
public string avenue { get; set; }
public string floor { get; set; }
public string landmark { get; set; }
public string street { get; set; }
public string location_id { get; set; }
public string email { get; set; }
public string last_name { get; set; }
public string city_id { get; set; }
public string user_id { get; set; }
public string building { get; set; }
public string token { get; set; }
public string address_id { get; set; }
public string save_address { get; set; }
public string first_name { get; set; }
public string phone_number { get; set; }
}
public class Toppingsarray
{
public string product { get; set; }
public string qty { get; set; }
public string topping_id { get; set; }
public string selection_id { get; set; }
public string option_id { get; set; }
}
public class ItemDetails
{
public string main_option_id { get; set; }
public string main_selection_id { get; set; }
public string product { get; set; }
public string qty { get; set; }
public string Price { get; set; }
public List<Toppingsarray> toppingsarray { get; set; }
}