I am trying to return JSON data with my restlet. I can return a single item\'s JSON with..
import org.json.JSONObject; Site aSite = new Site().getSite(); JSO
here is my solution using simple-json.
simple-json
JSONArray jr = new JSONArray(); for (int x = 1; x <= number_of_items; x++) { JSONObject obj = new JSONObject(); obj.put("key 1", 10); obj.put("key 2", 20); jr.add(obj); } System.out.print(jr);
Output:
[{"key 1":10,"key 2":20},{"key 1":10,"key 2":20}]