Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

RemoteControl 2 API - JsonObject analyse problem using Gson under Java

  • farfadet
  • farfadet's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 7 months ago #111644 by farfadet
Hi,

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":"email_1@gmail.com","status":"OK"},"338":{"name":" testNom2","email":"email_2@gmail.com","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 topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose