おそらくかなり些細な質問ですが、適切な答えが見つかりませんでした。実際の結果にプロパティ名がまったく含まれていない「JsonResult」を返したい。ここに私が達成したいことの小さな例があります:
["xbox",
["Xbox 360", "Xbox cheats", "Xbox 360 games"],
["The official Xbox website from Microsoft", "Codes and walkthroughs", "Games and accessories"],
["http://www.xbox.com","http://www.example.com/xboxcheatcodes.aspx", "http://www.example.com/games"]]
はい、非常に普通のソース コードが既にいくつか存在しますが、これに関連性があるとは思えません。ただし、次のとおりです。
public JsonResult OpensearchJson(string search)
{
/* returns some domain specific IEnumerable<> of a certain class */
var entites = DoSomeSearching(search);
var names = entities.Select(m => new { m.Name });
var description = entities.Select(m => new { m.Description });
var urls = entities.Select(m => new { m.Url });
var entitiesJson = new { search, names, description, urls };
return Json(entitiesJson, JsonRequestBehavior.AllowGet);
}