Android json

How to handle json in Android.
JSON-java provides one of good solution for it.

How to use?

JSON-java is pure java codes.
We can use it as Android code.
I tried to compile as android library(.jar), and it works fine.
If you want to it as it is, just copy source codes.
Please copy sources to package named org.json, org.json.zip

Now Android supports JSONObject provided by org.json

Sample Program

This is sample program for JSON-java

String str = "{\"key\":\"value\"}";
JSONObject jobj = new JSONObject(str);
String value = jobj.getString("key");
// Long, Boolean, Object, JSONArray, JSONOject
System.out.println(value); // "value"
    	
String str2 = "{\"name\":\"Homuhomu\", \"age\":14}";
JSONObject jobj2 = new JSONObject(str2);
Integer age = jobj2.getInt("age");
System.out.println(age);   // 14
System.out.println(jobj2.toString());  // String style

JSON?

Basically, JSON is used in Web Service API, Web related works.
In my case, I used receipt parser for Android, iOS, Amazon In app purchase(billing)
in server side.