Here's the scenario:
public class UnwrappedWithPropertyName {
public static void main(String[] args) throws JsonProcessingException {
final Address address = new Address(new Postcode("45678"));
final ObjectMapper mapper = new ObjectMapper();
System.out.println(mapper.writeValueAsString(address));
}
static class Address {
@JsonUnwrapped
@JsonProperty("postcode")
private final Postcode postcode;
Address(Postcode postcode) {
this.postcode = postcode;
}
public Postcode getPostcode() {
return postcode;
}
}
static class Postcode {
private final String value;
Postcode(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
}
That results in: {"value":"45678"} what I would expect is to see it as
{"postcode":"45678"}
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.