My code is here for converting JSON to string in C#
here is my class
public class Datum
{
public string quantity { get; set; }
public string price { get; set; }
public string name { get; set; }
}
public class TableDetails
{
public List<Datum> Data { get; set; }
public string TableName { get; set; }
}
}
here i parse this
TableDetails table =
JsonConvert.DeserializeObject<TableDetails>(context.DataFrame.ToString());
Error is here
{"Error converting value \"[{\"quantity\":\"1\",\"price\":\"350\",\"name\":\"Thai Fried Chicken\"}]\" to type 'System.Collections.Generic.List`1[AlchameyWebsoket.Datum]'. Path 'Data', line 1, position 82."}
I send this string from an android app here is the code i use in android
try{
JSONObject mainObj=new JSONObject();
JSONArray arr=new JSONArray();
for(int i=0;i<Memory.finalOrder.size();i++)
{
JSONObject jo = new JSONObject();
jo.put("name",Memory.finalOrder.get(i).getName());
jo.put("quantity",Memory.finalOrder.get(i).getQuantity());
jo.put("price",Memory.finalOrder.get(i).getPrice());
arr.put(jo);
}
mainObj.put("TableName",Memory.tableName);
mainObj.put("Data",arr.toString());
Please help me out of this problem