I have a payload that am trying to save into a database, whenever I post the payload, it returns the mapped JSON objects as null instead of the values in the payload passed.
here is the JSON payload
{
"authStatus": {
"authStatusCode": 131,
"authStatusDescription": "API call doesn't need authentication"
},
"results": {
"beepTransactionID": 10764659,
"payerTransactionID": "5f51eed7347a7",
"statusCode": "188",
"statusDescription": "Response was received"
}
}
after posting it to postman
{
"id": 14,
"authStatusCode": null,
"authStatusDescription": null,
"beepTransactionID": null,
"payerTransactionID": null,
"statusCode": null,
"statusDescription": null
}
my controller for posting
@PostMapping("/payload")
public Payload createPayload(@Valid @RequestBody Payload payload) {
return payloadRepository.save(payload);
}
my model
@Entity
@Table(name = "payload", schema = "public")
public class Payload {
private long id;
Integer authStatusCode;
String authStatusDescription;
Integer beepTransactionID;
String payerTransactionID;
String statusCode;
String statusDescription;
public Payload(){
}
//getters and setters