Access JSON Stringified data on Server side

2019-08-31 18:00发布

问题:

I want to use the JSON Stringified Array on the server side ::

The FOrmat of Sent Stringified data is::

task:[{"TaskID":4,"OwnerID":1,"RecurrenceID":null,"Title":"Test Title1234","Description":"Desc... ","Start":"2014-04-28T01:00:00.000Z","End":"2014-04-30T06:00:00.000Z","RecurrenceRule":"","RecurrenceException":"Task Exception Occured","IsAllDay":false}]

And on Server Side I am trying to access is as::

public virtual JsonResult Test_UpdateSchedule(IList<SchedulerViewModel> task)
{
//Implementation Code
}

But I am not able to access it here.

My FOrmat of ViewModel is as below::

 public class SchedulerViewModel 
    {
        public int TaskID { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public DateTime Start{get;set;}
        public DateTime End{get;set;}
        public string RecurrenceRule { get; set; }
        public int? RecurrenceID { get; set; }
        public string RecurrenceException { get; set; }
        public bool IsAllDay { get; set; }
        public int? OwnerID { get; set; }
        public string StartTimezone { get; set; }
        public string EndTimezone { get; set; }

    }

回答1:

Make sure your request is a POST and that your content type is application/json.

If you post how you're passing the data that might help us answer.