May 08, 2021 JSON
XML:
Extended Markup Language (Extensible Markup Language, XML), which is used to mark electronic files so that they have a structural markup language that can be used to tag data, define data types, and is a source language that allows users to define their own tag language.
JavaScript
Object Notation is a lightweight text data exchange format with good readability and easy-to-write features that allow data exchange between different platforms.
Both JSON and XML are human-readable formats and language-independent. I n a real-world environment, they all support creation, reading, and decoding. We can compare JSON and XML by:
XML files are large, the file format is complex, the transmission takes up bandwidth, JSON data format is relatively simple, easy to read and write, the format is compressed, the bandwidth is small.
XML is redundant than JSON, so it's faster for us to write JSON.
XML is used to describe structured data that does not contain arrays, while JSON contains arrays.
JSON can be resolved using JavaScript's eval method. When this method is applied to JSON, eval returns the object described.
Here's an example of XML and JSON, respectively:
{
"company": Volkswagen,
"name": "Vento",
"price": 800000
}
<car>
<company>Volkswagen</company>
<name>Vento</name>
<price>800000</price>
</car>
For more information about XML, please refer to the XML tutorial