JSON uses two types of brackets that are as follows:
JSON has the following types of structures that are:
1. JSON Objects
The elements inside the curly brackets are known as Objects.
2. JSON Array
A list of values, known as Arrays.
3. JSON Key-Value
This data is stored as a pair of keys and values. Here the keys can be a name, a number for which the values can be Seema, 98767586 etc.
Let us see some reasons for why to choose JSON over XML:
Let us see the code difference of JSON and XML files:
XML Example:
<?xml version= “1.0” encoding= “” ?>
<student>
<student>
<name> Sia Sharma</name>
<city> Chandigarh</city>
</student>
<student>
<name>Dimple D’souza</name>
<city> Nagpur</city>
</student>
<student>
<name>Anna Jones</name>
<city> Mumbai</city>
</student>
</student>
JSON Example:
{ “students”: [
{ “name”: “Sia Sharma”, “city”: “Chandigarh”},
{ “name”: “Prachi D’Souza”, “city”: “Nagpur”},
{ “name”: “Annas Jones”, “city”: “Mumbai”}
]}
I hope the difference is all clear in front of you. This is how simple JSON is and how easily it could be understood.
#android tutorials #json parsing in android #json parsing in android example #json parsing in android step by step #json parsing with android #read json file android