1

我正在对一些 JSON 进行简单解析,它在 chrome 中给了我一个错误,我在这里缺少什么?

Ext.util.JSON.decode("{info: {synopsis: 'test'}}");
SyntaxError: Unexpected token ILLEGAL

非常感谢

4

2 回答 2

7

http://www.json.org/

认为您应该使用双引号而不是单引号。

Ext.util.JSON.decode('{"info": {"synopsis": "test"}}');
于 2011-02-04T01:38:02.920 回答
4

如果你使用 ExtJs 4 以后要小心,你必须使用

Ext.JSON.decode('{"info": {"synopsis": "test"}}');  
于 2011-11-11T05:46:02.800 回答