我有一个从数据库中获取的字符串,需要将其转换为Javascript字典。
"['content':{'type':'file','path':'callie/circle'},'video':{'videoId':'CvIr-2lMLsk','startSeconds': 15,'endSeconds': 30'}]".
如何将上述字符串转换为Javascript字典?我是否应该先将字符串转换为json?当我尝试使用
json.parse
时,会显示错误:未捕获的SyntaxError:意外的令牌'
在对象解析(本地)
在:2:6
在Object.InjectedScript._evaluateOn(:905:140)
在Object.InjectedScript._evaluateAndWrap(:838:34)
在Object.InjectedScript.evaluate(:694:21)