-9

I have String like

[
   {
     "Title":"name",
     "Value":"Sam"
   }, 

   {
     "Title":"mobile",
     "Value":"(606) 87-0238"
   }
]  

want to convert it into List<JSONobj> list of JSONObject.

5
  • 4
    can we see what you have tried so far? so that we can append our ideas to your ideas. Commented Jan 6, 2016 at 11:46
  • 4
    stackoverflow.com/help/how-to-ask Commented Jan 6, 2016 at 11:47
  • Use JsonParser to parse this String. Refer this answer Commented Jan 6, 2016 at 11:49
  • Please mind all above comments and visit Convert JSONArray to String Array Commented Jan 6, 2016 at 11:57
  • please elaborate how to use Jsonparser fro this String Commented Jan 6, 2016 at 12:00

1 Answer 1

2
ArrayLis<JSONObject> list=new ArrayList<JSONObject>();

JSONArray arr= new JSONArray("json string");

for(int i=0;i<arr.length();i++){

JSONObject obj=arr.getJSONObject(i);

list.add(obj);

}

You have to do something like this.

Sign up to request clarification or add additional context in comments.

1 Comment

This should be Correct in my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.