[ {name: "name1", y: val1},
{name: "name2", y: val2},
{name: "name3", y: val3},
...,
{name: "nameN", y: valN}
]
我希望以JSON
格式获得价值
如何在piechart
的{{1}}中使用此格式?
答案 0 :(得分:0)
只需将值放在Hash中,然后使用render作为JSON。
def getOrganizationGroups() {
def result = GroupType.findAll().sort({it.sortOrder}).collect() {
[
code: it.groupTypeCode,
name: it.displayName,
sort: it.sortOrder
]
}
render(result as JSON)
}
答案 1 :(得分:0)
enter code here
def getData = Highchart.findAll()// Highchart域名 HashMap map = new HashMap(); map.put(getData.name,getData.data);`` 输出:{“[dari,anand]”:[5,6]}