Am using Spring boot with a Rest Controller. I have a @PostMapping
with a @RequestBody
having object that has id of type UUID
. When I am trying to test my post request from Postman I get the following error.
JSON parse error:
Cannot deserialize value of type
java.util.UUID
from String "4be4bd08cfdf407484f6a04131790949": UUID has to be represented by standard 36-char representation; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of typejava.util.UUID
from String "4be4bd08cfdf407484f6a04131790949": UUID has to be represented by standard 36-char representation
I read in some post that talked about invalidFormatException but with a different data type that need to write some kind of Adapter. How can I resolve this for the UUID? Thanks in advance for your input.
@PostMapping(value = "/save_order")
@ResponseStatus(HttpStatus.CREATED)
public void postOrder(@RequestBody Order order) {
...
public class Order {
@Id
private UUID dstId;
....