0

I am completely don't know Json. Now i am working in Android project. I know how to use ArrayList. I have Json file inside of my Asset folder in my Android Project.

So, now i need How to parse this file from assets folder and how to store it to ArrayList.

1
  • context.getResources().getAssets().open("{filename}", "{mode(read/write/read-write)}"); Commented Jul 14, 2015 at 6:50

1 Answer 1

4
String json="Your Json";
JSONObject resultJson = new JSONObject(json);
JSONArray value = resultJson.getJSONArray(<Pass Your JsonOject Key here>);
ArrayList<String> list = new ArrayList<>();

for (int i = 0; i < value.length(); i++)
{
    JSONObject qstnArray = value.getJSONObject(i);
    list.add(qstnArray.getString("question"));                  
}
Sign up to request clarification or add additional context in comments.

1 Comment

Hi I have the same problem can you help me?

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.