开发者

Pass JSON objects to an action and map to List<object>?

开发者 https://www.devze.com 2022-12-09 17:15 出处:网络
I have an action method that takes in two different objects. I am posting JSON to the action using jquery, to do this I put all the properties i want to map to my two objec开发者_如何学Pythonts in th

I have an action method that takes in two different objects.

I am posting JSON to the action using jquery, to do this I put all the properties i want to map to my two objec开发者_如何学Pythonts in the one Json object. This works correctly and maps to the two objects in my action!

I want to be able to pass Json and map to a list of objects? is this possible in asp .net MVC?

Thanks

UPDATE: Looks like ActionFilters are the way to go here! found this post.


I think you should map to an object[] instead of a List<object>. This should map when adding an array of JSON objects as argument to your function.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号