JSON Vs XML - Both are used to store and transfer data between server and client. Both are humanly machine-readable and language-independent.


JSON stands for Javascript object notation. It is a text-based data format that is used to store and transfer data from server to client and vice versa

JSON is derived from Javascript but it could be used by different languages such as Python, Ruby, PHP, and Java too. Therefore JSON is called language independent.

The JSON file can be saved as a .json file extension while it can be defined either in string format(inside of quotes) or object within other files.

How To Represent JSON

JSON can be represented either in object format or array format. Let us see each of them.

JSON Object

JSON object is written inside the curly braces {}.JSON object consists of key/value pairs such as {key:value}.Key-value must be placed inside the double quote as a string while the value can be put inside double quote incase of string otherwise do not put value inside double quote.

JSON Object
       "name": "smith", "salary": 500000,"age":32,"job":"ui/ux" 

JSON Array

JSON array written inside the square bracket like javascript array.

Source Code

            <script type="text/javascript">
// JSON array
 [ "apple", "mango", "banana"]
Try it now

Code Explanation


XML stands for Extensible Markup Language and it is also used to store and transfer data from server to client or browser and from client to server. It is used by different programming languages and it is again human and machine-readable.

Please keep in mind that XML is very similar to JSON but XML can take longer text and more time to read and write hence it also takes much to parse.

XML can be parsed with the help of an XML parser while JSON can ve parsed with the help of the javascript standard function.

XML Syntax

Tooltip initilization:jQuery
	<username>Smith</username> <Job>Designetr</Job>
	<username>John Doe</username>

Basic Difference Between JSON/XML

  • JSON is lighter than XML.
  • JSON takes less time to parse in comparison to XML.
  • JSON uses an array while the XML does not take an array.
  • JSON is parsed by a javascript special function while XML is parsed by the XML parser.
  • JSON does not use tags while XML uses tags.
  • JSON is fast processing rather than XML.

Web Tutorials

Html Tutorial HTML
Javascript Tutorial JAVASCRIPT
Css Tutorial CSS
Bootstrap 5 Tutorial BOOTSTRAP 5
Bootstrap 4 Tutorial BOOTSTRAP 4