JSON in Android
Mobile Application Development
JSON
JSON in Android
2
https://en.wikipedia.org/wiki/JSON
JSON
JSON in Android
3
https://en.wikipedia.org/wiki/JSON
JSON in Android
4
Source:-https://www.tutlane.com/tutorial/android/android-json-parsing-with-examples
JSON - Data types
JSON's basic data types are:
JSON in Android
5
JSON in Android
Android classes to access JSON in Android
to parse the JSON data to get the required information in android applications.
JSON in Android
6
JSONArray
JSON in Android
7
https://developer.android.com/reference/org/json/JSONArray
JSONArray
8
Constructors:
|
Methods: JSONArray getJSONArray(int index) |
JSONObject getJSONObject(int index) |
Long getLong(int index) |
String getString(int index) |
JSONArray put(int index, int value) |
JSONArray put(boolean value) |
https://developer.android.com/reference/org/json/JSONObject
JSONObject - class
Constructor:
Creates a new JSONObject with name/value mappings from the JSON string.
JSON in Android
9
https://developer.android.com/reference/org/json/JSONObject
JSONObject - class
Methods:
int getInt(String name)
Returns the value mapped by name if it exists or throws Exception otherwise.
JSONArray getJSONArray(String name)
JSONObject getJSONObject(String name)
JSONObject put(String name, long value)
JSON in Android
10
https://developer.android.com/reference/org/json/JSONObject
Example
JSON in Android
11
https://www.digitalocean.com/community/tutorials/android-jsonobject-json-parsing
Example
JSON in Android
12
Courtesy:
https://www.digitalocean.com/community/tutorials/android-jsonobject-json-parsing
Example
JSON in Android
13
Courtesy:
https://www.digitalocean.com/community/tutorials/android-jsonobject-json-parsing