I have been familiar with JSON before and haven't made a deep Comparison Between XML and JSON. I saw a post today, but it's not bad. Let's take a look at it ~ ◆Readability
The readability of JSON (Java Object Notation) and XML is comparable. One side is the suggested syntax and the other side is the standard tag format, which makes it difficult to distinguish between them. ◆Scalability XML is inherently highly scalable, and JSON is also available. There is nothing XML can be extended, and JSON cannot. ◆Encoding difficulty XML has rich coding tools, such as dom4j and JDOM, and JSON also provides tools provided by json.org. However, JSON encoding is much easier than XML, JSON code can be written without tools, but it is not easy to write XML. ◆Decoding difficulty XML parsing takes into account the parent node of the child node, which is confusing, and the difficulty of JSON Parsing is almost 0. There is nothing to say about XML. ◆Instance comparison Both XML and JSON use structured methods to mark data. The following is a simple comparison. Assume that a user data includes the user name, password, department, gender, and age. It is represented as follows in XML: <? XML version = "1.0" encoding = "UTF-8"?> <User> <Name> Zhang San </Name> & Lt; password & gt; 123456 & lt;/password & gt; <Department> Technical Department </Department> <Sex> male </sex> <Old> 30 </old> </User> JSON format: { "Name": "Zhang San ", "Password": "123456 ", "Department": "Technology Department ", "Sex": "male ", "Old": 30 } Like XML, JSON is also text-based and uses unicode encoding, which is also readable. XML is more suitable for marking documents, while JSON is more suitable for data exchange processing. |