0

I want to add integer array as a request param in json .I am adding it by using the method.

org.json.JSONObject jsonObject=new org.json.JSONObject();
jsonObject.accumulate("",integerArray); 

but when i am adding it as a param it get converted as string,so not able to parse on server side. Android-Client side. Java -Server side.

Jhanvi
  • 5,069
  • 8
  • 32
  • 41
user2990781
  • 41
  • 1
  • 3

2 Answers2

0

I'm not a JSON expert, but have you converted it back to a JSONArray on the server side?

JSONArray array = jsonObject.optJSONArray("myArray");

To make this work you have to call sonObject.accumulate("myArray",integerArray); of course.

s.d
  • 4,017
  • 5
  • 35
  • 65
0

Use

org.json.JSONObject jsonObject=new org.json.JSONObject();
jsonObject.accumulate("",new org.json.JSONArray(integerArray));

on the client side.

HHK
  • 4,852
  • 1
  • 23
  • 40