I am trying to test my spring web service by using Advanced REST Client. My DTO and Controller looks like:
DTO(Data Transfer Object):
public class SecurityQuestionDTO{
private Character[] question;
private boolean status;
@JsonProperty("userSecurityAnswerList")
private List<UserSecurityAnswer> userSecurityAnswerList;
}
Controller:
@Controller
@RequestMapping("/utility")
public class UtilityWebService {
@Autowired
private ISecurityQuestionService securityQuestionService;
@RequestMapping(value = "/security", method = RequestMethod.POST)
@ResponseBody
public SecurityQuestionDTO saveSecurityQuestion(
@RequestBody SecurityQuestionDTO securityQuestionDTO) {
return this.securityQuestionService
.saveSecurityQuestion(securityQuestionDTO);
}
}
When I tried to add SecurityQuestion, a status showing "400 Bad Request" appears. My JSON format looks like:-
JSON Format:
{
"question" : {'Q', 'u', 'e', 's', 't', 'i', 'o', 'n'},
"status" : true,
"userSecurityAnswerList" : null
}
URL
http://localhost:8080/abc/utility/security
How can I avoid the Bad Request Error? how Character[] datatype is represented in JSON?