1

I am sending a JSON string (JSON.stringify(data)) as body in a POST request from client to .NET MVC5 app. Request header has the content type of application/json (I do not want to change this to text or remove it). Below is my controller.

 [HttpPost]
        public JsonResult LogUIAnalytics(Object userAnalytics)
        {
           log.Info("UserAnalytics:"+JsonConvert.SerializeObject(userAnalytics));
           return Json(true);
        }

My userAnalytics object in parameter upon debugging shows as {}. The thing is I have various objects to log to splunk and each has different model so I do not want to use any particular model type as method param. What is the request param I should be using for this generic case for logging object as string? I tried using JObject, string etc but all of them picking up only null.

0 Answers0