C# の場合:
var cities = clients.Select(c =>
new {
DisplayText = c.CityName,
Value = c.CityId
});
return Json(new { Result = "OK", Options = cities });
Railsでこれをどのように実行しますか?
ターゲット json:
{
"Result" : "OK",
"Options": [
{ "DisplayText" : "clientName1", "Value" : 1},
{ "DisplayText" : "clientName2", "Value" : 2},
]
}