How to ignore Json root name in Spring Boot?

You may annotate User.id field with @JsonUnwrapped annotation to effectively flatten the underlying structure like this:

public class User {
    @JsonUnwrapped
    private UserPK id;
    private String name;
}

See the docs.