XML vs JSON
Since 1998, XML, or “Extensible Markup Language”, had been the industry standard for storing and transferring data. In 2002, JSON or JavaScript Object Notation officially launched its website and slowly became the industry standard by 2013 (Walker, 2022). Aside from age, there are many differences and benefits and disadvantages to using one over the other. Here I will try to touch on many of them and provide you with code snippets to help you visualize their unique styles.
XML is very similar to HTML in that it has opening and closing tags. These tags are defined by the programmer to give better descriptions of what the data is. This is an advantage in that you get to create specific tags, but it also is a disadvantage in that it looks similar to other markup languages. All data within the tags must be strings which are great for name and word-based data, but hard to work with numbers and dates. Since it has been around longer, it has a huge list of platforms that accepts it, but it still needs to be parsed (Walker, 2022).
JSON won out because of its object-looking style making it more lightweight and quicker to transfer. The syntax has opening and closing brackets, not tags, and pairing the name of the data to the data gives the programmer license to be creative in naming data. A huge win is that since it is an object, many types of data can be stored, not just strings. It is easier to read and write, and it’s super easy, barely an inconvenience for JavaScript and other newer programming languages to parse the data. Many databases have either started using JSON or a variation thereof because of its simplicity (Walker, 2022).
Below are code snippets showing how the two differ in style:
Get Ace D Baugh’s stories in your inbox
Join Medium for free to get updates from this writer.
XML:
JSON:
References
Walker, A. (2022, August 29). JSON vs XML — difference between them. Guru99. Retrieved September 19, 2022, from https://www.guru99.com/json-vs-xml-difference.html




