JSON Input for POST request to call REST API
问题 How do i convert a model Person to match the input? Person p = new Person(name, age, amountInBank); (name in String, age in int and amountInBank in double) I want my JSON Input to be as follow: { "ID": "H123", "list" : [ { "name" : "ally", "age": 18, "amountInBank": 200.55 } ] } Currently my code to call REST API is: JSONObject jsonInput= new JSONObject(); jsonInput.put("ID", "H123"); //put in list input in JSON -> HELP NEEDED Resource resource = client.resource(URL HERE); resource