/ FRONT-END

JSON & XML

XML & JSON


XML

XML (eXtensible Markup Language) is a text-based data format as Markup language.
HTML only have fixed tags, the tages already have roles.
However, XML can make any tages by a user.
XML can make new tags for new data independently.


JSON

JSON (JavaScript Object Notation) is a text-based data format and a lightweight data-interchange format. It transmits data between computers.

Nowadays, JSON is more popular than XML because it is light and easy to understand.


JSON features

JSON is a plain text written in JavaScript object notation.
JSON can be translated to JavaScript Object through JavaScript.
JSON is language independent, JSON exists in many programming languages.


Difference between XML and JSON

  • XML has tags covering data, which is similar to HTML tags.
  • JSON has {} instead tags, and split ‘,’ data by data.

  • JSON uses null, number, string, array, object, boolean

The use of JSON

JSON is serialized to send data through network.
It is used for Web applications, server, API, and browsers.
It is also used for storing objects.


Issues of JSON

AJAX (Asynchronous JavaScript And XML) is a part of JavaScript that transfers data with servers.
AJAX may send not JSON data but JavaScript itself, AJAX may not distinguish JSON and JavaScript.


JSON is just data format.
To get the JSON data, they use XMLHttpRequest() function in JS,
this function only support the original server that JS is uploaded.
JSON is only available on the server having JS.
e.g. In google.com, we only can get JSON from Google, not other websites.