The issue you're facing is likely due to missing getter and setter methods in your Java class. Ensure that your class has public getter and setter methods for the fields that need to be serialized to JSON.
Alternatively, you can use Lombok, which provides convenient annotations like @Data, @Getter, @Setter, and @AllArgsConstructor, so you don't have to manually write all the getter, setter, and constructor methods. Adding Lombok to your project can simplify your code and save time.