Parsing simple JSON using Ext gives SyntaxError: Unexpected token ILLEGAL

前提是你 提交于 2019-12-24 09:03:49

问题


i'm doing a simple parse of some JSON and it's giving me an error in chrome, what am i missing here?

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

Thanks a lot


回答1:


http://www.json.org/

Think you should use double quotes instead of single quotes.

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



回答2:


Be careful if you are using ExtJs 4 onward, You have to use

Ext.JSON.decode('{"info": {"synopsis": "test"}}');  


来源:https://stackoverflow.com/questions/4893714/parsing-simple-json-using-ext-gives-syntaxerror-unexpected-token-illegal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!