0

I need to get the values of the array "q1" which in array "questions", the arrays is json, and i need the values in java android.

{
    "questions": [
        {
            "q1": [
                "what my name?",
                "a",
                "b",
                "c",
                "Mac"
            ],
            "q2": [
                "what my age?",
                "1",
                "34",
                "80",
                "3"
            ]
        }
    ]
}
4
  • You should show the effort you put in. We are not here to spoon feed you Commented Oct 24, 2015 at 15:25
  • 1
    Are you asking how to parse json using Java? What have you tried? Commented Oct 24, 2015 at 15:26
  • Look at the documentation on the existing json frameworks? Good place to start. Commented Oct 24, 2015 at 15:32
  • I tried a lot of very but i could not understand how to do that, I can to get values from one array but array within array i could not do it. and yes, in java Commented Oct 24, 2015 at 15:40

1 Answer 1

1

Here I am answering your question to solve your problem but My friend you need to study first about json parsing.

Suggestion : You can find example of it here :

http://primalpappachan.com/android/2010/06/05/parsing-json-in-android/

Answer :

JSONObject jresonseobj = response.getjObj();
JSONObject jobj;
JSONArray jsonArray = new JSONArray(jresonseobj.getString("questions"));

for (int i = 0; i < jsonArray.length(); i++) 
{
        jobj = jsonArray.getJSONObject(i);
        // parse inner json here.  
}
Sign up to request clarification or add additional context in comments.

Comments

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.