Android JSON Parser | Android Tutorial
Android JSON Parser | Android Tutorial
In this article, we will cover the following topics
- What is JSON Parser?
- Advantages of JSON over XML
- What is a JSON Object?
- What is JSON Array?
What is JSON Parser?
JSON stands for JavaScript Object Notation. It is a lightweight and structural language. It is textual and subject of the JavaScript language. It is the best alternative to XML. It is a data-interchange format of the server's data. Android language extends support to all the JSON classes such as JSONArray, JSONObject. It supports all the other forms of JSON that are used in parsing the JSON data and fetching the information through the program.
Advantage of JSON over XML
- For AJAX applications, JSON is much easier to with than XML.
- In comparison to XML, it is much faster to read and write.
- It uses the concept of an array.
What is a JSON Object?
It is represented by the set of curly braces({ }). Like maps, JSON objects contain items in key-value pairs. The data type of keys is most probably string and the values are of JSON data types. The keys and values are separated by commas.
Example of JSON Object
{
"student": {
"name": "naveen",
"UID": 1889,
"gender": “M”
}
}
What is JSON Array?
JSON Array is represented by the set of square brackets ([ ]). JSON Objects can be used within the JSON Array.
Example of JSON Array
["January", “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”]