I am working on a web API with ASP.NET MVC (.NET 4.5.2) (I'm quite new to ASP) and I would like the change to response format from my controller to be JSON instead of XML.
I tried several things like using the ActionResult return type and returning something like new Json() but this function is not recognized and Visual Studio asks me to create the function.
I'm not sure I'm giving you enough info to help me, so please ask me for more if necessary :)
Thanks!
return "{\"decision\":\"enable\"}";in my controller, I get"{\"decision\":\"enable\"}"in my browser (so not valid JSON). On the other hand, if I configure with application/json, I still get XML but this time, the string in the XML is fine. Can't I use application/json in the configuration ?