Yeah, mark is right. Its a JSONArray. On Wed, May 25, 2011 at 11:48 PM, Mark Murphy <[email protected]>wrote:
> The error message is correct. "final" is not a JSONObject. It is a > JSONArray. You can tell that by the square brackets, instead of > braces. > > On Wed, May 25, 2011 at 1:57 PM, Expressions Unlimitted > <[email protected]> wrote: > > I am facing problem with parsing json data. Here is my json > > json string : {"final":[{"id":1,"value":14,"name":"Mohammad Arif"}]} > > and here is android code : > > String jsonstring=jsonstring; // the above json string > > jobject=new JSONObject(jsonstring); > > JSONObject object=jobject.getJSONObject("final"); > > > > String name=object.getString("id"); > > txt.setText(name); > > ------------------------------------------------------ > > But i get the following error : > > JSONException --> [final] is not json object > > /////////////////////////////////////////////////////////////////////// > > Actually i want to get data such as id, name and value etc > > > > --------------------------------------------------------------------- > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > > http://groups.google.com/group/android-developers?hl=en > > > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > _The Busy Coder's Guide to Android Development_ Version 3.6 Available! > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

