Im building a JObject myself and want to return it as ActionResult. I dont want to create and then serialize a data object
For example
public ActionResult Test(string id) { var res = new JObject(); JArray array = new JArray(); array.Add("Manual text"); array.Add(new DateTime(2000, 5, 23)); res["id"] = 1; res["result"] = array; return Json(res); //??????? }
You should just be able to do this in your action method:
return Content( res.ToString(), "application/json" );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With