2013-02-18 56 views
0

我有这个字符串字符串转换为JSON对象的数组,轨道3+

astring='[{"name": "daus", "total": "45", "ios": "30", "android": "15"},{"name": "davus", "total": "38", "ios: 27", "android": "11"}]' 

,我想通过

ajson = JSON.parse(astring) 

将其转换成JSON,但我收到此错误:

JSON::ParserError: 399: unexpected token at '{"name": "davus", "total": "38", "ios: 27", "android": "11"}]' 

我假设我的错误是在我设置初始字符串的方式,但还没有能够解决它。

回答

2

语法错误:

"ios: 27" -> "ios": "27"