سؤال

I have to send this Json:

{"method":"startSession", "params":["email" "email@email.it", "password" "1234", "stayLogged" "1", "idClient" "IPHONE"], "id":1} 

the problem is that: I don't know how to send a json with Exactly this form because of the params' value array, I must send the array as value of the key params, but if I try to use:

jsonObject.put("params", paramemsArr);

to put a String array, the put doesn't work correctly and the Json assume a wrong form

If I try to put the params in a Json array and add the json array in analogue way the json assume the wrong form

{"method":"startSession", "params":[{"email" "email@email.it", "password" "1234", "stayLogged" "1", "idClient" "IPHONE"}], "id":1} 

How could I send a Json with exactly this form

{"method":"startSession", "params":["", "email@email.it", "password", "stayLogged", "idClient"], "id":1}
هل كانت مفيدة؟

المحلول

define paramemsArr as JSONArray instead of a String array, read more about JSONArray at http://developer.android.com/reference/org/json/JSONArray.html

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top