我是grails的新手...
我想为我的 jquery 自动完成创建一个控制器
def arrSong = Song.executeQuery("select id, title as value, concat(artist, ' - ', title) as label from ${Song.name} where title like concat('%', :paramTitle, '%')", [paramTitle:params.term?.toString()])
render arrSong as JSON
使用此代码,我得到此 JSON:
[[1,"Mr. Brightside","The Killers - Mr. Brightside"]]
我的期望是:
[{"id":1,"value":"Mr. Brightside","label":"The Killers - Mr. Brightside"}]
任何人都可以帮忙吗?