java - Converting JSONArray String to array -


i have json data

{"mydata":{"numbers":[12,23,34]}} 

by taking jsonobject following object:

jsonobject obj = mydataobj.getjsonobject("mydata"); 

so obj this:

{"numbers":[12,23,34]} 

i need use numbers elements. make for-loop use elements.

string numbers = myobject.getstring("numbers"); 

this gives string this:

["12","23","34"] 

how can convert array or arraylist?
have array having values of 12, 23 , 34.

edit: after getting array, arraylist of jsonarray, compare "numbers1_array" , "numbers2_array". find elements exists in first array doesn't exists in second array. selecting data structure type related compare operation easier.

you try getjsonarray() instead of getstring(), , iterate on jsonarray , build arraylist.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -