JavaScript Object Notation (JSON) is an open-standard file format. JSON uses human-readable text to transmit data objects consisting of name–value pairs, and array data types (or any other serializable value). JSON is a very common data format used for asynchronous browser–server communication, including as a replacement for XML.
There are multiple online resources describing the similarities and differences between JSON and XML. The table below describes a portion of them:
JSON |
XML |
It is JavaScript Object Notation |
It is Extensible markup language |
It is based on JavaScript language. |
It is derived from SGML. |
It is a way of representing objects. |
It is a markup language and uses tag structure to represent data items. |
It does not provides any support for namespaces. |
It supports namespaces. |
It supports array. |
It doesn’t supports array. |
Its files are very easy to read as compared to XML. |
Its documents are comparatively difficult to read and interpret. |
It doesn’t use end tag. |
It has start and end tags. |
It is less secure. |
It is more secure than JSON. |
It doesn’t supports comments. |
It supports comments. |
It supports only UTF-8 encoding. |
It supports various encoding. |
Source: https://www.geeksforgeeks.org/difference-between-json-and-xml/