发送json请求:
RequestSpecification request = RestAssured.given().header("Content-Type", "application/json");
JSONObject requestParams = new JSONObject();
JSONObject childObject1= new JSONObject();
JSONObject childObject2 = new JSONObject();
requestParams.put("contactClass", "ZWSS");
requestParams.put("contactActivity", "0039");
requestParams.put("contractAccountNumber", "210024144291");
requestParams.put("text", "Please rate the overall ease of using the website to initiate or make your service request");
requestParams.put("contactType", "Z1");
requestParams.put("contactDirection", "1");
childObject1.put("question", "0001");
childObject1.put("answer", "01");
childObject1.put("question", "0002");
childObject1.put("answer", "02");
JSONArray jsonArray = new JSONArray();
jsonArray.put(childObject1);
jsonArray.put(childObject2);
requestParams.put("addInfo", jsonArray);
request.body(requestParams.toString());
Response response = request.post("https://api-dev.adp.com/api/*/*/*");
Reference
java api
http://static.javadoc.io/io.rest-assured/rest-assured/3.0.1/index.html