How can I map:
user: {
#user1: "http:www.example.com/user1"
}
To a class?
I tried:
public static final class User {
public final String user1;
@JsonCreator
public User(@JsonProperty("#user1") String user1) {
this.user1 = user1;
}
}
The problem I ran into was that #user1
changes. It might be #user1
or #user2
or contain multiple #user1
, #user2
, etc simultaneously.
This will result in:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "#user2"