Similar questions have been asked in the past, but they seem to be a bit from now on. I am trying to get general consensus on the best way to create JsonResult in ASP.NET MVC. The context of this question is to use the most advanced methods available from .NET 4 / 4.5 and MVC 4
Here are some popular methods I've come across over the years:
var json1 = new { foo = 123, bar = "abc" }; var json2 = new Dictionary<string, object>{ { "foo", 123 }, { "bar", "abc" } }; dynamic json3; json3.foo = 123; json3.bar = "abc";
Also explain the advantages / disadvantages of your preferred method.
source share