How do I / is it possible to pass in a json object to a webapi controller (POST) and not have a class to map it to, but rather handle it as arbitrary content?
We passed json object by jquery, and parse it in dynamic object. it works fine. this is sample code:
ajaxPost:
...
Content-Type: application/json,
data: {
"name": "Jack",
"age": "12"
}
...
webapi:
[HttpPost]
public string DoJson2(dynamic data)
{
string name = data.name;
int age = data.age;
return name;
}
similary question on stackoverflow: WebAPI Multiple Put/Post parameters