JSON and XML pros and cons
One 、JSON The definition of
A lightweight data exchange format , It has good readability and easy to write quickly . Mainstream technology in the industry provides a complete solution ( It’s kind of like regular expressions , Supported by most of today’s languages ), So that data can be exchanged between different platforms .JSON Using a highly compatible text format , At the same time, it also has the characteristics similar to C The behavior of the language system .
Two 、XML The definition of
Extended Markup Language (Extensible Markup Language, XML) , A markup language used to mark electronic documents to make them structured , Can be used to tag data 、 Define data types , Is a source language that allows users to define their own markup language . XML It’s a standard universal markup language (SGML) Subset , Very suitable Web transmission .XML Provides a unified way to describe and exchange structured data independent of the application or vendor .
3、 … and 、JSON and XML A comparison of advantages and disadvantages
1、 In terms of readability ,JSON and XML The readability of the data is basically the same .JSON and XML Its readability is comparable , On one side is the suggested grammar , One side is the standard label form , It’s hard to tell the difference .
2、 In terms of scalability ,XML It’s naturally extensible ,JSON Of course, there are , Nothing is XML Can expand ,JSON No way .
3、 In terms of coding difficulty ,XML There are plenty of coding tools , such as Dom4j、JDom etc. ,JSON Also have json.org Tools provided , however JSON The coding of is obviously better than XML It’s a lot easier , You can write… Even without tools JSON Code for , But write well XML It’s not so easy .
4、 In terms of decoding difficulty ,XML The resolution of the child node must consider the parent node , It’s dizzy , and JSON The difficulty of analysis is almost 0. This point XML What a loser .
5、 In terms of popularity ,XML It has been widely used in the industry , and JSON Just getting started , But in Ajax This particular field , The future development must be XML Give way to JSON. then Ajax Should become Ajaj(Asynchronous Javascript and JSON) 了 .
6、 JSON and XML It also has rich analytical means .
7、 JSON be relative to XML Speaking of , The volume of data is small .
8、 JSON And JavaScript The interaction is more convenient .
9、 JSON The descriptive ratio of data XML Poor .
10、 JSON It’s much faster than XML.
Read more here: Source link