java - parse json array in android -


I need a help ... I have a php file which gives me two Jason Array which are as follows: {"id": "1", "item": "hammers", "corridor": "20"} {"id": "1", "item": "hammers" "corridor": "20 "}] [{" Id ":" 1 "," itemfound ":" your item #item "," thank you: ":" And thanks for using Texaco! " }]

Now, I want to get second array items in Android. I have the following code that is now like: JSONArray jsonArray = New JSONArray (Results);

 for  (int i = 0; i & lt; jsonArray.length (); i ++) {JSONObject jsonObject = JsonArray.getJSONObject (i); Items.add (jsonObject.getString ("item")); Aisles.add ("" + jsonObject.getString ("item");}   

But obviously, it gives me the object from the first array. I want to get the objects from the other Any suggestion.

Your JSON is not valid, but you can get the following element: string array [] = str.split (try "\\ [\\ {"); // {many solutions (only one worlaround).

  string str = "YOUR_JSON_RESPONSE" JSONArray jsonArray = New JSONArray ("[[[[" + array [2])); } Grip (JasonAxpection E) {// Two-Auto Auto-Generated Catch Block E.Pintstaxtress (); }    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -