json数据相对于xml数据.
- JSON is a valid subset of JavaScript, Python, and YAML
- JSON parsing is generally faster than XML parsing.
- JSON is a more compact format, meaning it weighs far less on the wire than the more verbose XML.
- JSON is easier to work with in some languages (such as javascript, python, and php)
- Formatted JSON is generally easier to read than formatted XML.
- JSON specifies how to represent complex datatypes, there is no single best way to represent a data structure in XML.
- JSON is a natural data structure for Javascript -- it is in fact javascript. This makes it an easy and light model for data transfer <> server/services.
- JSON is a nice format to extract XML data into. It's much nicer than extracting a big XML document...into a smaller XML document.
- I am going to assuming that you asking about advantages of each format in the context of an ajax response. The biggest advantage for me is that JSON ends up being much, much easier to traverse, identify, and read nodes than XML. XML methods are cumbersome and long to write, while JSON is much more cruft and simple.
- Helpful In the mobile context - it is also often less verbose than XML which helps to reduce bytes transferred.
- More structural information in the document
- Can easily distinguish between the number 1 and the string "1" as numbers, strings (and Booleans) are represented differently in JSON.
- Can easily distinguish between single items and collections of size one (using JSON arrays).
- Easier to represent a null value.
- Easily consumed by JavaScript
Advantages of XML
- Namespaces allow for sharing of standard structures
- Better representation for inheritance
- Standard ways of expressing the structure of the document: XML schema, DTD, etc
- Parsing standards: DOM, SAX, StAX
- Standards for querying: XQuery and XPath
- Standards for transforming a document: XSLT
eg.
to expand on the last point, the JSON object
{ "foo": { "bar": "baz" } }
could be represented in XML as
<foo bar="baz" .>
or
<foo><bar>baz</bar></baz>
or
<object name="foo">< property name="bar">baz</property ></object>
json数据相对于xml数据.的更多相关文章
- 如何使用Google APIs和Google应用系统集成(7)----在里面JSON兑换XML数据处理,JSON数据包括违规XML数据规范:XML节点名称不支持号码Java解
笔者电话Google Calendar APIs的GetColors方法,其中(有关详细信息Google Calendar API已经Google API看到我的博文介绍的其余部分,目前,我们只取Go ...
- 【Flex】读取本地JSON,然后JSON数据转成XML数据
package utils { import flash.xml.XMLDocument; import flash.xml.XMLNode; import mx.rpc.xml.SimpleXMLE ...
- Ajax--解析JSON数据与解析XML数据
一.Ajax解析JSON数据 nav.json(json数据) [ { "link":"http://www.jd.com", "src": ...
- 把txt格式数据制作成xml数据
txt格式数据: 代码: s1=""" <object> <name>{0}</name> <pose>Unspecifi ...
- 以对象的方式来访问xml数据表(三)
怎样以对象的方式来访问xml数据表? 在讲如何具体实现(二)中所说的专门用于访问xml文件的动态链接库之前,我们先来看看这个动态链接库具体要实现什么功能. 动态链接库IXmlDB.dll的功能: 1. ...
- iOS开发网络篇—XML数据的解析
iOS开发网络篇—XML数据的解析 iOS开发网络篇—XML介绍 一.XML简单介绍 XML:全称是Extensible Markup Language,译作“可扩展标记语言” 跟JSON一样,也是 ...
- WebService传递XML数据 C#DataSet操作XML 解析WebService返回的XML数据
Webservice传递的数据只能是序列化的数据,典型的就是xml数据. /// <summary> /// 通过用户名和密码 返回下行数据 /// & ...
- tcp接收xml数据解析
避免tcp接收xml数据时加上xml数据长度,根据xml数据特点来解析recv到的xml数据 int nPos1 = 0; int nPos2 = 0; int nTempPos = 0; int n ...
- 使用Java创建XML数据
------------siwuxie095 工程名:TestCreateXML 包名:com.siwuxie095.xml 类名:CreateXML. ...
随机推荐
- Apache下PHP的几种工作方式
PHP在Apache中一共有三种工作方式:CGI模式.Apache模块DLL.FastCGI模式. 一.CGI模式 PHP 在 Apache 2中的 CGI模式.编辑Apache 配置文件httpd. ...
- The first time
早上起来发现昨晚申请的博客开通了,\(^o^)/~纪念下,就像刚打代码学的hello world一样,用c,c++写一个程序纪念下.O(∩_∩)O~哈哈哈哈哈. /*C hello world程序*/ ...
- Delphi图像处理控件
Envision Image Library (Full Sources for D7 to D10-Seattle) v3.08http://www.intervalsoftware.com/env ...
- perl 正则详解
用/s 来匹配任意字符 默认情况下,点号(.)无法匹配换行符,这对大多数单行匹配的情况是合适的. . 圆点用于匹配除换行符外的任何单个字符 + 意味着一个或多个相同的字符 .+ 匹配任意单个字符至少一 ...
- Excel进行项目规划的好处
1.表格的方式 2.多个工作表 3.插入图片 4.清晰的规划 5.大众都能看得懂 6.辅助一些数据表设计,其他的流程设计 7.对项目该做什么,进度等等有一个明确的认识 8.项目管理,吃透需求,对进度把 ...
- Hadoop MapReduce中压缩技术的使用
Compression and Input Splits 当我们使用压缩数据作为MapReduce的输入时,需要确认数据的压缩格式是否支持切片? 假设HDFS中有一个未经压缩的大小为1GB的文 ...
- sql优化(oracle)
系统优化中很重要的方面是SQL语句的优化,对于海量数据,优质的SQL能够有效的提高系统的可用性. 总结的有点罗嗦,列个简单的目录啦~ 目录 第一部分知识准备 ...
- cryptopp开源库的使用(零):windows下使用visual studio编译
编译相当简单:打开目录下的sln文件直接编译即可,官方支持到vc2012,我使用vs2013也没有错误,优秀的开源库总是便于使用. 编译的时候注意运行库得选择需要跟使用该库的保持一致,否则会出现重定义 ...
- Java---文件的切割与合并,已经实现图形界面(工具)
实现对任意文件的切割,实现对切割后的文件的合并. 上次只写了特定目录下的文件切割与合并,有点遗憾, 这次,我写了一个图形界面来实现对文件的切割与合并. 文件切割: 用户可以自己选择需要切割的文件, 软 ...
- yum nfs
linux下3大文件共享方法 1.NFS NFS服务器配置 编辑/etc/exports,在文件中列出,要共享的目录.书写规则是:共享目录主机(参数).并且每条规则占据一行.例如: /mnt/mp3 ...