Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: RemoteControl 2 API - JsonObject analyse problem using Gson under Java

RemoteControl 2 API - JsonObject analyse problem using Gson under Java 2 years 2 months ago #111644

  • farfadet
  • farfadet's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 8
  • Thank you received: 2
  • Karma: 0

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.
The administrator has disabled public write access.
Time to create page: 0.226 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form