I want to return JSON below.
{ "name": "jackie" }
Postman is giving me error. Stating
Unexpected 'n'
New to Spring Boot here. 1 day old. Is there a proper way to do this?
// POST method here
@RequestMapping(method = RequestMethod.POST , produces = "application/json")
ResponseEntity<?> addTopic(@RequestBody Topic topic) {
if (Util.save(topicRepository, new Topic(topic.getTopicName(), topic.getQuestionCount())) != null) {
return Util.createResponseEntity("Name : jackie", HttpStatus.CREATED);
}
return Util.createResponseEntity("Error creating resource", HttpStatus.BAD_REQUEST);
}