RemoteControl 2 API - JsonObject analyse problem using Gson under Java

2 years 7 months ago #111644 by farfadet

I got a problem within the 'invite_participants' function.
Folowing a successfull use the LimeSurvey server returns to me for ex. following json

{"id":1,"result":{"337":{"name":" testNom1","email":"","status":"OK"},"338":{"name":" testNom2","email":"","status":"OK"},"status":"0 left to send"},"error":null}

Thats globally fine! :)

But if the request is only partially successfull with a global status {... ,"status":"X left to send"}
I'd like to access the "individual" status (dunno what it'll be among String, Array, etc.) of each member of the "result" (which is a JsonObject) to see which one(s) have messed up.

My problem is that the id's (in this case "337" and "338") are unknown to my program and I can't figure out how to set up something like:

for (result having members) {
invite=result.get(member) ;
if (invite.has("status")) { check("status") and do something consequently }

but as it's a JsonObject and no JsonArray I don't have access to kind of size() and get(int i) method's.

Would be glad if anybody could help.
Thanks in advance.

Please Log in to join the conversation.