Karthik K

Karthik K

  • 1k
  • 743
  • 193.4k

How to read String Array to Load DataTable in C# ?

Nov 21 2019 11:53 PM
Hi All ,
 
In My Current Application i would have to read the string array to DataTable in asp.net. Whole structure of string array screen shot in Attatchment. Find the Att..If anyone knows any solution suggest me with sample code.
  1. private void AddOrders()  
  2. {  
  3. var val = "{\"operator\":1, " +  
  4. " \"table_no\": 1," +  
  5. " \"Pax\": 0," +  
  6. " \" order_items\":[" + OrderItem() + "] }";  
  7. Session["Order_Items"] = val;  
  8. Arrlist = new string[] { val };  
  9. //Response.Write("aw");  
  10. // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('" + Arrlist.ToString() + "');", true);  
  11. }  
  12. Var val Will return the Following Result . This below Data Need to Read and Loaded in Datatable ..  
  13. {"operator":1,  
  14. "table_no": 1,  
  15. "Pax": 0, "  
  16. order_items":  
  17. [{"product_id": 5,  
  18. "product_barcode": 88823065,  
  19. "product_price":12.20,  
  20. "quantity":1,  
  21. "remarks":  
  22. [{"remarkName""Vegetarian+ 0.00 " },  
  23. {"remarkName""Meat+ 0.00 " },  
  24. {"remarkName""Shirataki Zero C.NDL +2.00" },  
  25. {"remarkName""Cauliflower Rice +1.00" },  
  26. {"remarkName""SPRITE+ 0.00 " },  
  27. {"remarkName""TUNA TATAKI +1.00" },  
  28. {"remarkName""Brown Rice+ 0.00 " }  
  29. ],  
  30. "is_set_meal":0,"manualRemark":""},  
  31. {"product_id": 10,  
  32. "product_barcode": 8888075005920,  
  33. "product_price":12.20,  
  34. "quantity":1,  
  35. "remarks":[{"remarkName""Vegetarian+ 0.00 " },  
  36. {"remarkName""Meat+ 0.00 " },  
  37. {"remarkName""Cauliflower Rice +1.00" },  
  38. {"remarkName""Tendon +3.00" },  
  39. {"remarkName""SODA+ 0.00 " },  
  40. {"remarkName""SPICY TUNA +2.00" },  
  41. {"remarkName""SALMON MENTAI +2.00" },  
  42. {"remarkName""SPICY SHIRATAKI NOODLES +2.00" },  
  43. {"remarkName""SESAME DRESSING+ 0.00 " }  
  44. ],  
  45. "is_set_meal":0,"manualRemark":""}  
  46. ] }  
Thanks in advance
Karthik K

Answers (1)