您的位置:首页 > Web前端 > JavaScript

什么是JSON——Atlas采用的数据传输格式

2006-11-15 18:17 423 查看
在学习Atlas时已经n次看到JSON这个名词,今天特地查了一下。

原来JSON是一种用基于文本的数据描述格式,全称“JavaScript Object Notiation”,类似于XML和SOAP,同样具有跨平台的特性。

我举一个小例子,

先看看用Xml描述论坛中的帖子:

<posts>
<post>
<id>1</id>
<title>帖子1</title>
<content>内容</content>
<posterId>13</posterId>
</post>
<post>
<id>2</id>
<title>帖子2</title>
<content>内容</content>
<posterId>13</posterId>
</post>
</posts>

使用JSON:

{posts:[
{
id:1,
title:"帖子1",
content:"内容",
posterId:13
},
{
id:2,
title:"帖子2",
content:"内容",
posterId:13
}
]};

Atlas从Beta版开始全面用JSON格式描述服务器和客户端之间传输的数据,Microsoft.Web.Script.Services命名空间提供这方面的支持。

以下提供一点参考资料,仅供大家对JSON进行浅显的了解。

微软的Ajax道路:ASP.NET
AJAX的JSON

The
AJAX response: XML, HTML, or JSON?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐