Using JSON with Android
Imports required import org.json.JSONArray ; import org.json.JSONObject ; import org.json. JSONException; Creating JSON Object public void writeJSON() { JSONObject object = new JSONObject(); try { object.put("name", "Jack Hack"); object.put("score", new Integer(200)); object.put("current", new Double(152.32)); object.put("nickname", "Hacker"); } catch (JSONException e) { e.printStackTrace(); } System.out.println(object); } Converting a JSON string into JSON object String jsonString = readJsonObjectFromSomeWhere(); try { JSONObject json = new JSONObject(jsonString); } catch ( Exception e) { e.printStackTrace(); } Now use methods of JSON object to read the items 1 Object get(String name) This method just Returns the value but in the form of Object type 2 boolean getBoolean(String name) This method returns the boolean value ...