在C#中自己的名字:Rails的,包括在JSON
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},
]
}
請加上返回的JSON的例子 – Intrepidd 2013-03-05 12:35:20