You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Deserialization of beans with @JsonProperty annotation works but for deserialization behavior is very strange.
In the test below serialization ouput from toJson is : {"name":"name","host":"localhost","host":"localhost","name":"name"}
Which is incorrect. Fields are not named according to @JsonProperty and are duplicated, it should be :
{"Name":"name","Address":"localhost"}
Thx
public class Registration {
@JsonProperty("Name")
private String name;
@JsonProperty("Address")
private String host;
}
public class TestSerializeRegistration {
@Test
public void test() {
Registration registration = new Registration();
registration.setName("name");
registration.setHost("localhost");
ObjectMapper mapper = JsonFactory.create();
String jsonSource = "{\"Name\":\"name\",\"Address\":\"localhost\"}";
Registration unserializedRegistration = mapper.fromJson(jsonSource, Registration.class);
String json = mapper.toJson(unserializedRegistration);
Assert.assertEquals(json, jsonSource);
}
}
The text was updated successfully, but these errors were encountered:
Hi,
Deserialization of beans with @JsonProperty annotation works but for deserialization behavior is very strange.
In the test below serialization ouput from toJson is : {"name":"name","host":"localhost","host":"localhost","name":"name"}
Which is incorrect. Fields are not named according to @JsonProperty and are duplicated, it should be :
{"Name":"name","Address":"localhost"}
Thx
The text was updated successfully, but these errors were encountered: