• 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数据.的更多相关文章

  1. 如何使用Google APIs和Google应用系统集成(7)----在里面JSON兑换XML数据处理,JSON数据包括违规XML数据规范:XML节点名称不支持号码Java解

    笔者电话Google Calendar APIs的GetColors方法,其中(有关详细信息Google Calendar API已经Google API看到我的博文介绍的其余部分,目前,我们只取Go ...

  2. 【Flex】读取本地JSON,然后JSON数据转成XML数据

    package utils { import flash.xml.XMLDocument; import flash.xml.XMLNode; import mx.rpc.xml.SimpleXMLE ...

  3. Ajax--解析JSON数据与解析XML数据

    一.Ajax解析JSON数据 nav.json(json数据) [ { "link":"http://www.jd.com", "src": ...

  4. 把txt格式数据制作成xml数据

    txt格式数据: 代码: s1=""" <object> <name>{0}</name> <pose>Unspecifi ...

  5. 以对象的方式来访问xml数据表(三)

    怎样以对象的方式来访问xml数据表? 在讲如何具体实现(二)中所说的专门用于访问xml文件的动态链接库之前,我们先来看看这个动态链接库具体要实现什么功能. 动态链接库IXmlDB.dll的功能: 1. ...

  6. iOS开发网络篇—XML数据的解析

     iOS开发网络篇—XML数据的解析 iOS开发网络篇—XML介绍 一.XML简单介绍 XML:全称是Extensible Markup Language,译作“可扩展标记语言” 跟JSON一样,也是 ...

  7. WebService传递XML数据 C#DataSet操作XML 解析WebService返回的XML数据

    Webservice传递的数据只能是序列化的数据,典型的就是xml数据.   /// <summary>         /// 通过用户名和密码 返回下行数据         /// & ...

  8. tcp接收xml数据解析

    避免tcp接收xml数据时加上xml数据长度,根据xml数据特点来解析recv到的xml数据 int nPos1 = 0; int nPos2 = 0; int nTempPos = 0; int n ...

  9. 使用Java创建XML数据

    ------------siwuxie095                         工程名:TestCreateXML 包名:com.siwuxie095.xml 类名:CreateXML. ...

随机推荐

  1. python学习之旅:array 转 list

    最近学习python,记录学习的点滴. >>> import numpy as np >>> a = np.array([[1,2],[3,4]]) >> ...

  2. Linux 下安装Python框架django建立与mysql的连接

    0.基本环境说明: a. Ubuntu 14.04 64bit b. python 2.7.6 c. django 1.8 d. django-registration e. django-widge ...

  3. How to create Managed Metadata Column

    This article introduce how to create/use managed metadata column from List. First, we need to config ...

  4. Hibernate的查询语言之HQL(一)——快速入门

    Hibernate提供异常强大的查询体系,使用Hibernat有多种查询方式可以选择:即可以使用Hibernate的HQL查询,也可以使用条件查询,甚至可以使用原生的SQL查询语句.不仅如此, Hib ...

  5. POJ1260 Pearls(dp,矩阵链乘法)

    题目链接. 题目大意: 给定一个n,和两个序列a[i], p[i]. a[i] 表示需要购买 i品质 的数量,p[i] i 等级的价格. 1.每个品质都会有不同的价格,价格依据品质上升而上升 2.买一 ...

  6. EDM(邮件营销)

    官冲拉手网CTO举了个EDM(邮件营销)的例子: 在做大数据分析应用之前,通过EDM带来的订单转化率很低.在采用大数据解决方案后,可以根据用户之前的浏览习惯猜测他的喜好和购买习惯,从而针对性的推送个性 ...

  7. linux中的cd ..和cd -命令有什么区别?

    cd ..是返回上一层目录, cd -是返回到上一次的工作目录,如果当前目录是/执行cd /usr/local再执行cd ..就是到 /usr而执行cd -就是到/

  8. 2014-08-22 关于Response、Request等对象在cs文件中的使用

    今天是在吾索实习的第33天.已经有一段时间没写过博客了,今天突然想起个值得分享的东西,所以又华丽地回归了. 废话不多说了,直奔主题.我们会发现,在我们在cs文件中,直接使用Response.Reque ...

  9. 关于C#中Thread.Join()的一点理解

    原文地址:http://www.cnblogs.com/slikyn/articles/1525940.html 今天是第一次在C#中接触Thread,自己研究了一下其中Thread.Join()这个 ...

  10. Hive学习笔记【转载】

    本文转载自:http://blog.csdn.net/haojun186/article/details/7977565 1.  HIVE结构 Hive 是建立在 Hadoop 上的数据仓库基础构架. ...