访问JSON字符串化在服务器端数据 [英] Access JSON Stringified data on Server side
本文介绍了访问JSON字符串化在服务器端数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用JSON字符串化阵列服务器端:
发送字符串化数据的格式是:
任务:[{的TaskID:4,OWNERID:1,RecurrenceID:空,标题:测试Title1234,说明:说明。 .. \",\"Start\":\"2014-04-28T01:00:00.000Z\",\"End\":\"2014-04-30T06:00:00.000Z\",\"RecurrenceRule\":\"\",\"RecurrenceException\":\"Task出现异常,IsAllDay:假}]
和服务器端我试图访问是:
公共虚拟JsonResult Test_UpdateSchedule(IList的< SchedulerViewModel>任务)
{
//执行code
}
但我不能在这里访问它。
我的视图模型的格式如下:
公共类SchedulerViewModel
{
公众诠释的TaskID {搞定;组; }
公共字符串名称{搞定;组; }
公共字符串描述{搞定;组; }
公开日期时间启动{获取;设置;}
公众的DateTime结束{获取;设置;}
公共字符串RecurrenceRule {搞定;组; }
公众诠释? RecurrenceID {搞定;组; }
公共字符串RecurrenceException {搞定;组; }
公共BOOL IsAllDay {搞定;组; }
公众诠释? OWNERID {搞定;组; }
公共字符串StartTimezone {搞定;组; }
公共字符串EndTimezone {搞定;组; } }
解决方案
请确保您的要求是一个 POST
键,您的内容类型是应用程序/ JSON
。
如果您上传您是如何传递一个能帮助我们回答的数据。
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; }
}
解决方案
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.
这篇关于访问JSON字符串化在服务器端数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文