Skip to content
Loading
+2
  • Ajaz Khan
    +2

    Hi All,

     

    I implemented blow class for getting above json formating but i am not getting properly data values ,data values seeing null and need the above format json data. Please kindly suggest me ,how i can achieve that.

     

    Model....

     

    public class Data

    {

    [JsonProperty("Service Line")]

    public string ServiceLine { get; set; }

    [JsonProperty("Problem Type Code")]

    public string ProblemTypeCode { get; set; }

    [JsonProperty("Problem Type Desc")]

    public string ProblemTypeDesc { get; set; }

    [JsonProperty("Request Priority")]

    public string RequestPriority { get; set; }

    public string Supplier { get; set; }

    public string Site { get; set; }

    [JsonProperty("Unit#")]

    public string Unit { get; set; }

    [JsonProperty("Request Creation Date")]

    public string RequestCreationDate { get; set; }

    [JsonProperty("Request Closure Date")]

    public string RequestClosureDate { get; set; }

    [JsonProperty("Mobile (MSISDN)")]

    public string MobileMSISDN { get; set; }

    [JsonProperty("EXT#")]

    public string EXT { get; set; }

    [JsonProperty("Customer's Name")]

    public string CustomerSName { get; set; }

    [JsonProperty("Customer's eMail")]

    public string CustomerSEMail { get; set; }

    public string TimeZone { get; set; }

    }

    public class PhoneNumberStatus

    {

    }

    public class Root

    {

    public string id { get; set; }

    public string contactListId { get; set; }

    public Data data { get; set; }

    public string callable { get; set; }

    public PhoneNumberStatus phoneNumberStatus { get; set; }

    }

     -------------------------------------------------------------------------------------------------------------

    controller...

     

    [HttpGet]

    public IEnumerable GetClosedSeviceRequest()

    {

    try

    {

    List Model = new List();

    DataTable dt = new DataTable();

    if (Provider == "SQL")

    dt = QueryHelper.GetServiceRequestSQL();

    else

    dt = QueryHelper.GetServiceRequestSQL();

    Model = DBHelper.ToList(dt);

    return Model;

    }

    catch (Exception ex)

    {

    ErrorHandler.WriteError(ex.Message);

    return null;

    }

    }

     

    -------------------------------------------------------------------------------------

     

    Result.............

     

     

    [

    {

    "id": "",

    "contactListId": "65bdb317-b4d7-4319",

    "data": null,

    "callable": "true",

    "phoneNumberStatus": "1"

    },

    {

    "id": "",

    "contactListId": "65bdb317-b4d7-4319",

    "data": null,

    "callable": "true",

    "phoneNumberStatus": "1"

    }

    ]

     

     

     

    TIA 

    +2