如何读取这个Json到控制器对象?(How to read this Json to controller object? Kendo UI grid server filtering)

我正在尝试过滤Kendo UI网格服务器端过滤器。 开发人员工具在查询字符串中显示此内容

/ Home / GetUsmMessage?{“filter”:{“logic”:“and”,“filters”[{“field”:“MessageId”,“operator”:“eq”,“value”:1}]},“ group“:[]} GET 200 application / json

我创建了一个对象结构,以便我将结构读入对象

public ActionResult GetUsmMessage(FilterContainer filter) { //Code to read the filter container return Json(jsonData, JsonRequestBehavior.AllowGet); }

过滤容器的对象结构:

public class FilterContainer { public List<FilterDescription> filters { get; set; } public string logic { get; set; } } public class FilterDescription { public string @operator { get; set; } public string field { get; set; } public string value { get; set; } public List<FilterDescription> filters { get; set; } public string logic { get; set; } }

当我调试控制器功能时,它仍然给我一个空对象。 请帮忙

I am trying to filter Kendo UI grid server side filter. The developer tools show this in query string

/Home/GetUsmMessage?{"filter":{"logic":"and","filters" [{"field":"MessageId","operator":"eq","value":1}]},"group":[]} GET 200 application/json

I created a object structure so that I read the structure to object

public ActionResult GetUsmMessage(FilterContainer filter) { //Code to read the filter container return Json(jsonData, JsonRequestBehavior.AllowGet); }

Object structure for filter container:

public class FilterContainer { public List<FilterDescription> filters { get; set; } public string logic { get; set; } } public class FilterDescription { public string @operator { get; set; } public string field { get; set; } public string value { get; set; } public List<FilterDescription> filters { get; set; } public string logic { get; set; } }

It still gives me a null object when I debug controller function. Please help

最满意答案

得到了答案......我忘了添加请求类型作为Http帖子....

Got the answer...I forgot to add type of request as Http post ....

如何读取这个Json到控制器对象?(How to read this Json to controller object? Kendo UI grid server filtering)

我正在尝试过滤Kendo UI网格服务器端过滤器。 开发人员工具在查询字符串中显示此内容

/ Home / GetUsmMessage?{“filter”:{“logic”:“and”,“filters”[{“field”:“MessageId”,“operator”:“eq”,“value”:1}]},“ group“:[]} GET 200 application / json

我创建了一个对象结构,以便我将结构读入对象

public ActionResult GetUsmMessage(FilterContainer filter) { //Code to read the filter container return Json(jsonData, JsonRequestBehavior.AllowGet); }

过滤容器的对象结构:

public class FilterContainer { public List<FilterDescription> filters { get; set; } public string logic { get; set; } } public class FilterDescription { public string @operator { get; set; } public string field { get; set; } public string value { get; set; } public List<FilterDescription> filters { get; set; } public string logic { get; set; } }

当我调试控制器功能时,它仍然给我一个空对象。 请帮忙

I am trying to filter Kendo UI grid server side filter. The developer tools show this in query string

/Home/GetUsmMessage?{"filter":{"logic":"and","filters" [{"field":"MessageId","operator":"eq","value":1}]},"group":[]} GET 200 application/json

I created a object structure so that I read the structure to object

public ActionResult GetUsmMessage(FilterContainer filter) { //Code to read the filter container return Json(jsonData, JsonRequestBehavior.AllowGet); }

Object structure for filter container:

public class FilterContainer { public List<FilterDescription> filters { get; set; } public string logic { get; set; } } public class FilterDescription { public string @operator { get; set; } public string field { get; set; } public string value { get; set; } public List<FilterDescription> filters { get; set; } public string logic { get; set; } }

It still gives me a null object when I debug controller function. Please help

最满意答案

得到了答案......我忘了添加请求类型作为Http帖子....

Got the answer...I forgot to add type of request as Http post ....