REST Assured accepts a request body as a raw JSON String, a Java Map/List, or a POJO (which it serializes to JSON automatically via Jackson/Gson). Set contentType so the server interprets it correctly.
You can pass .body("{\"name\":\"QA\"}") (raw string), .body(mapOfFields) (a Map serialized to JSON), or .body(userPojo) (a Java object serialized by Jackson/Gson on the classpath). POJO bodies are preferred for maintainability and type safety — you build a User object and REST Assured converts it. contentType(JSON) ensures Content-Type is set. For form submissions use formParam or contentType(URLENC). Building bodies from POJOs/Maps avoids brittle escaped JSON strings and keeps test data structured and reusable.
Creating a user from a POJO: User u = new User('QA', 'qa@test.com'); given().contentType(JSON).body(u).when().post('/users') — Jackson serializes u to JSON automatically.
Why is given().body(userPojo) preferred over given().body("{ big escaped JSON string }")?