android - Iterating through JSONObjects -



android - Iterating through JSONObjects -

i have tried several of examples listed , none of them seem work reason posting new question.

i have json string coming me objects (it not formatted in array). need parse out team names this. know need iterate on them keys , store objects in new array.

here json (a sample of it)

{"query":{"printrequests":[{"label":"","typeid":"_wpg","mode":2,"format":false}],"results":{"team:kubbchucks":{"printouts":[],"fulltext":"team:kubbchucks","fullurl":"http://wiki.planetkubb.com/wiki/team:kubbchucks","namespace":822,"exists":true},"team:kubbchucks idp":{"printouts":[],"fulltext":"team:kubbchucks idp","fullurl":"http://wiki.planetkubb.com/wiki/team:kubbchucks_idp","namespace":822,"exists":true}},"serializer":"smw\serializers\queryresultserializer","version":0.5,"meta":{"hash":"8407a177d701d746edc3066a012c17d2","count":2,"offset":0}}}

what have far dig downwards level of json (data string above)

jsonobject parsing = new jsonobject(data); jsonobject query = parsing.getjsonobject("query"); jsonobject results = query.getjsonobject("results");

this allows me manually check team using :

jsonobject teamone = results.getjsonobject("team:kubbchucks");

this of course of study not ideal. total json file has 3000 entries , not know entries are. need iterate on results object keys start "team:"

i've tried few different iterator samples none seem working me , starting frustrate me. believe me, i've tried many things before asking question. help appreciated.

i had similar problem time ago. can this:

jsonobject results = query.getjsonobject("results"); iterator<string> iterator = results.keys(); while (iterator.hasnext()) { jsonobject team = results.getjsonobject(iterator.next()); // stuff }

android json key iteration

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -