I have following two string with me
String macId= "484487E3A0AC",484487E3FG55,484487E3A0FG,484487HJKL90,484487EKLJK9;
String movieList="Cast Away";
I want to send it to my server as json Object, I am able to achieve it when I send it as single object :
EX:
String macId= "484487E3A0AC";
String movieList="Cast Away";
JSONObject json = new JSONObject();
json.accumulate("title", movieList);
json.accumulate("mac", macId);
httppost.setEntity(new StringEntity(json.toString()));
httpclient.execute(httppost);
finally the json data which I am sending looks like this :
{"mac":"484487E3A0AC","title":"Cast Away"}
Now I have a requirement where My macId is a list (there might be around 10 macId) , where as the movieList will be same . What will be the most optimized way to convert it to json object . Server side coding reads the data as :
{"mac":"......","title":"......"}
So got to convert it accordingly , Please provide some solution as how to club it together