I have a following JSON String , which is passed as a input parameter of my Web-API. I face trouble in accessing the multilevel JSON data , only NULL value is receiving in parameter.
{"Customer":{"Abc":67,"Def":"main_user","Hij":"0123","Kel":0},"CustomerOrder":{"OrderID":1,"CartId":1,"Amount":10.00,"LogId":123,"UserId":4},"Actions": [ "value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ]}
Class In C#
public class Rootobject
{
public Customer Customer { get; set; }
public Customerorder CustomerOrder { get; set; }
public Action[] Actions { get; set; }
}
public class Customer
{
public int Abc { get; set; }
public string Def { get; set; }
public string Hij { get; set; }
public int Kel { get; set; }
}
public class Customerorder
{
public int OrderID { get; set; }
public int CartId { get; set; }
public float Amount { get; set; }
public int LogId { get; set; }
public int UserId { get; set; }
}
public class Action
{
public string value { get; set; }
public string onclick { get; set; }
}
Here i accept the data from postbody,
[Route("~/FetchData")]
// [ActionName("VoucherStatus")]
[HttpPost]
// GET: http://localhost:28056/FetchData/ //
public ProcessedResponse<DashBoradController> ProcessVoucherFetch([FromBody] Rootobject request)
{ // Some operatons }
Is it possible to read entire JSON string like above ? Can any one help to fix, i have did the one layer of JSON like this below,
{ "Abc":67, "Def":"main_user", "Hij":"0123", "Kel":0 }
But multilevel JSON gives NULL.