Am 02.09.11 16:10, schrieb ashish: > How to check whether an element is a JSONArray or JSONObject. I wrote > the code to check,
try this: JSONObject jObject = new JSONObject(); JSONArray jArray = new JSONArray(); Object test = jObject; if (test instanceof JSONObject) { Log.i("test", "JSONObject"); } else if (test instanceof JSONArray) { Log.i("test", "JSONArray"); } test = jArray; if (test instanceof JSONObject) { Log.i("test", "JSONObject"); } else if (test instanceof JSONArray) { Log.i("test", "JSONArray"); } -- Ralph Bergmann iOS and Android app developer www http://www.the4thFloor.eu | http://www.dasralph.de mail ra...@the4thfloor.eu skype dasralph xing http://www.xing.com/profile/Ralph_Bergmann3 gulp http://www.gulp.de/Profil/RalphBergmann.html linkedin http://www.linkedin.com/in/ralphbergmann java user group http://www.jug-bb.de | http://www.xing.com/net/jugbb ios dev group http://www.xing.com/net/iosberlin pgp key id BED003DD883B9A80 pgp fingerprint 7865 EAD3 5834 705B D8B7 AD7C BED0 03DD 883B 9A80 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en