You could use a package like org.json http://www.json.org/java/
Because you will need to use JSONObjects more often.
There you can easily create JSONObjects and put some values in it:
JSONObject json = new JSONObject();
JSONArray array=new JSONArray();
array.put("1");
array.put("2");
json.put("friends", array);
System.out.println(json.toString(2));
{"friends": [
"1",
"2"
]}
edit This has the advantage that you can build your responses in different layers and return them as an object