0

I am creating one Json array object and trying to pass it in MVC controller action method but i am getting null paramerter; as per my knowledge json only maps .net primitive datatypes.... so it assign null value.

Note: when i have look at request object i found that there are three parameter of created array. But how to get that value as parameter of function?

tereško
  • 58,060
  • 25
  • 98
  • 150
ArpanDesai
  • 87
  • 3
  • 11

2 Answers2

0

If you don't like to create custom model class for each time you call an action, then you can use my solution here

Pass JSON Object To MVC Controller as an Argument

Community
  • 1
  • 1
Mohsen Afshin
  • 13,273
  • 10
  • 65
  • 90
0

You need to create a custom model binder which will take the json value and construct a model object which can be passed into your action.

Another option is to use a different value binder. See Phil Haack's site for an example.

OJ.
  • 28,944
  • 5
  • 56
  • 71