[b]ECMA-262(E3)[/b] 中没有将JSON概念写到标准中,还好在[b] [url=http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf]ECMA-262(E5) [/url][/b]中JSON的概念被正式引入了,包括全局的JSON对象和Date的toJSON方法。
1,eval方式解析,恐怕这是最早的解析方式了。如下:
[url=http://blogs.msdn.com/ie/archive/2008/09/10/native-json-in-ie8.aspx]http://blogs.msdn.com/ie/archive/2008/09/10/native-json-in-ie8.aspx[/url] [url=https://developer.mozilla.org/en/Using_JSON_in_Firefox]https://developer.mozilla.org/en/Using_JSON_in_Firefox[/url]
使用JSON.parse需严格遵守JSON规范,如属性都需用引号引起来,如下
[url=http://www.1sucai.cn/article/25988.htm]Chrome中JSON.parse的特殊实现[/url]