简体   繁体   中英

Read the values from the jsonArray

I have a JSONArray like below

System.out.println(jsonArray.get(i));
//output
["4","3","2","1","3","5","6"]

How can i access the values inside the array. For Example if i want value 2 from the above array which is at index 2, what should i use to get the value

Assuming you have a org.json.JSONArray

String s = jsonArray.getJSONArray(i).getString(2);

should do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM