我的ViewBag.Result
字符串值为"[['Garreth','VP'],['Johan','IT'],['Test','QA']]"
我想将其转换为javascript数组
var dataset =
[
['Garreth','VP'],
['Johan','IT'],
['Test','QA']
]
显然var dataset = '@ViewBag.Result'
不起作用,因为javascript视为字符串而不是数组。知道怎么做吗?
由于
答案 0 :(得分:0)
只需删除单引号:
var dataset = @ViewBag.Result