[ {name: "name1", y: val1},
{name: "name2", y: val2},
{name: "name3", y: val3},
...,
{name: "nameN", y: valN}
]
我想以这种JSON
格式获得价值
如何在grails
piechart
中使用此格式?
只需将值放在哈希中,然后使用渲染为 JSON。
def getOrganizationGroups() {
def result = GroupType.findAll().sort({it.sortOrder}).collect() {
[
code: it.groupTypeCode,
name: it.displayName,
sort: it.sortOrder
]
}
render(result as JSON)
}
enter code here
def getData = Highchart.findAll((//Highchart 域名HashMap map = new HashMap((;map.put(getData.name,getData.data(;''输出:{"[达里,阿南德]":[5,6]}