JSON object in json array in Android -


i want put objects in array , in spinner (caracteristici) response gets information. project stoped when should put them in array.

    try {                     jsonobject jobj = new jsonobject(response);                     jsonarray caracteristiciarray = jobj.getjsonarray(constants.tag_caracteristici);                     caracteristici.clear();                     (int = 0; < caracteristiciarray.length(); i++) {                        jsonobject c = caracteristiciarray.getjsonobject(i);                        caracteristici.add(new caracteristici(c.getstring(constants.tag_caracterizare),     c.getstring(constants.tag_statistica))); 

response: {"clasa_caracterizare":[{"denumire_caracterizare":"adezivi si lacuri"},{"denumire_caracterizare":"materiale"},{"denumire_caracterizare":"altele"}]}....

you try extract constants.tag_caracterizare , constants.tag_statistica - objects have 1 string element - unless constants.tag_caracterizare equal constants.tag_statistica - fail


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -