I've been looking over the Internet but didn't find something relate to my problem.
I have visual studio 2017. Working in 4.6.1 .NET framework. The application is an asp.net MVC 4 application (standard).
I have a controler Dataset :
public class DatasetController : Controller
{
[System.Web.Http.HttpPost]
public JsonResult Push(dynamic data)
{
try
{
//here data has a value of {object} and is object typed
}
catch(Exception ex)
{
}
return Json(null);
}
}
The client can push any kind of data he wants. I will handle the structure from the dynamic object. I tried to switch to IDictionary type. But sub object still get the {object} value thing...
Here is the JSON sent (with content type as application/json) through Postman.
{
data: {
ApplicationName: "test",
TestObject: {
Name:"TestObject",
TestInt: 42
}
}
}
My problem is I don't know how to deal with this kind of object. How can I retrieve information from ? I can't call :
var test = data.ApplicationName
It will throw a RuntimeBinderException with message "object" does not contain a definition for ApplicationName.
With strongly typed variables or interfaces I never ran into such a problem (bassically obvious...).
Please tell me if my post lack of information.
Thank you for your time.
EDIT : Added precisions about my problem and the Exception I could get trying to work with this object