This should be simple.
I have an integer array that I want to encode in JSON formatting so I can pass it to a web service:
int[] myInts = new int[length-1];
myInts = {5, 6, 7, 1, 12, ..., 78};
JSONArray jArray = new JSONArray();
//now what?
Thanks.
If i where you I’d create a JSONObject first and then create the JSONArray and use
and finally add the jsonarray to the JSONObject. I suppose this would work nice for a small set of numbers however if you want to pass a large set of integers there should be a more elegant way to do it than this.