Android Post JTS HTTP JSON settings without double quotation marks

advertisements

I want to send Json Parameters (below) in Android - POST Method.

{"message":"This is venkatesh","visit":[5,1,2]}

I tried the below code

                String IDs="5,1,2";
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("message", "This is venkatesh");

                JSONArray jsonArray = new JSONArray();
                jsonArray.put(IDs);
                jsonObject.put("visit", jsonArray);
                String json = jsonObject.toString();
                Log.d("Mainactivity", " json" + json);

I am getting the output is

{"message":"This is venkatesh","visit":["5,1,2"]}
 // Output i am get with double quotes inside visit

{"message":"This is venkatesh","visit":[5,1,2]}
// I want to send this parameter without Double quotes inside the Visit


String IDs="5,1,2";
String[] numbers = IDs.split(",");
                JSONArray jsonArray = new JSONArray();

for(int i = 0; i < numbers.length(); i++)
{
    jsonArray.put(Integer.parseInt(numbers[i]));
}

Hope this helps.