I have a JsonObject created using Google Gson.
JsonObject jsonObj = gson.fromJson(response1_json, JsonElement.class).getAsJsonObject();
Also i made some modification to existing jsonobj as below :
JsonObject newObject = new JsonObject();
newObject.addProperty("age", "50");
newObject.addProperty("name", "X");
jsonObj.get("data").getAsJsonArray().add(newObject);
Now, using rest assured, i need to send the post request with this jsonobject. I tried the following but it doesn't work and throws exception:
Response postResponse =
given()
.cookie(apiTestSessionID)
.header("Content-Type", "application/json")
.body(jsonObj.getAsString())
.when()
.post("/post/Config");
Please guide me on this.