ResponseEntity incorrectly maps values

I have two entities: Product and Variant. Each product has a set of Variant. To get a product, I have a controller endpoint: http://localhost:8081/api/products/{id}

Hence to call a product, I'll have to call this endpoint:
    @GetMapping("{productId}")
    public ResponseEntity<Object> getProduct(
        @PathVariable Long productId
    ) {
        ProductDto productDto = productService.getProduct(productId);
        return ResponseEntity.status(HttpStatus.OK).body(productDto);
    }

Well, I have tried debugging the problem and even explicitly serializing the objects before I pass it to the ResponseEntity's body, none works. Images attached described my attempt on verifying whether the object passed to the .body was changed:
Left picture: I explicitly serialize it and debugging the output to the console. You can see that the serialization process works correctly.

Right picture: I only printed the first and last variant id of the product's variants. It resulted in the correct return of variant ids.
a4a76c83-08ea-408e-a57f-0b793838fe4c.png
637b9549-abf7-44d3-8cfd-30a13a76157c.png
Was this page helpful?