ajax の結果に使用される匿名オブジェクトの例を次に示します。
public ActionResult SomeActionMethod() {
return Json(new {foo="bar", baz="Blech"});
}
これは非常に簡単ですが、次のようなものがあります。
public ActionResult SomeActionMethod() {
var result = new ????
result["foo"] = "bar";
// Do some other stuff
...
result["john"] = "doe";
// Do some other stuff
...
return Json(result);
}
結果のカスタムクラスを作成することは避けたいので、上記のようなものを好むでしょう。