什么是JSON
JSON(Javascript Object Notation) 是一种轻量级的数据交换格式。易于人阅读和编写。同时也易于机器解析和生成。它基于Javascript Programming Language, Standard ECMA-262 3rd Edition - December 1999的一个子集。JSON采用完全独立于语言的文本格式,但是也使用了类似于C语言家族的习惯(包括C, C++, C#, Java, Javascript, Perl, Python等)。这些特性使JSON成为理想的数据交换语言。
JSON概念很简单,就是服务器直接生成Javascript语句,客户端获取后直接用eval方法来获得这个对象,这样就可以省去解析XML的性损失。
例如:
使用XML表示:
代码:
<items>
<item>
<id>1</id>
<author>Jackson</author>
<url>http://www.etoow.com</url>
<content>Welcome to etoow.com</content>
</item>
<item>
<id>2</id>
<author>Relkn</author>
<url>http://www.etoow.com</url>
<content>etoow.com关注互联网新技术</content>
</item>
<item>
<id>3</id>
<author>Kvogend</author>
<url>http://www.etoow.com</url>
<content>etoow.com关注WEB2.0</content>
</item>
</items>
使用JSON:
伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-08/1188478900.html
什么是JSON
'http://www.etoow.com/html/2007-08/1188478900.html