我正在尝试使用 Google Charts API 生成图表,但似乎无法获取所需格式的数据。
serializeJSON(data)
在 Coldfusion 中给了我 JSON 数据,但看起来这不是 Charts API 所期望的。我可以使用任何组件将其转换为所需的格式吗?
询问
<cfquery name="getAllUsers" datasource="cccac_swipe" result="UserDetailsResult">
Select login_mode,count(login_mode) as total from login_activity,ccac_registered_users where login_activity.student_id=ccac_registered_users.student_id GROUP BY login_mode
</cfquery>
ColdFusion 的 JSON
{"COLUMNS":["LOGIN_MODE","TOTAL"],"DATA":[["manual",123],["swipe",20]]}
预期的 JSON
{ "cols": [ {"id":"","label":"SignIn Method","pattern":"","type":"string"}, {"id":"","label":"Count","pattern":"","type":"number"} ], "rows": [ {"c":[{"v":"manual","f":null},{"v":123,"f":null}]}, {"c":[{"v":"swipe","f":null},{"v":20,"f":null}]} ] }