java - Use values (integers) returned in JSONArray -
im having issues being able indivisual responses json array. im trying write code allow me use vaules indivisually, how combine them if needed too. these responses integers.
java
jsonobject jsonobj = new jsonobject(jsonstr); data_array = jsonobj.getjsonarray("data"); (int = 0; < data_array.length(); i++) { jsonobject prod = data_array.getjsonobject(i); log.d("logging response", prod); }
json
[5652,8388,8388,7537,8843,2039,8235,0,12220]
i'd figure out how can add them , return calculated result, how use them individually. such (prod + prod + prod) etc...
use
jsonarray data = jsonobj.getjsonarray("data"); (int = 0; < data.length(); i++) { integer prod = (integer) data.get(i); system.out.println("prod " + prod); // loop , add array or arraylist }
Comments
Post a Comment