Say like we have a class like below with annotation defaultValue:
@jsonSerializable
class Test {
@JsonProperty(defaultValue: 4)
int value;
Test(this.value);
}
Then deserialize it use below code:
var t1 = JsonMapper.deserialize<Test>( '''{"value":12}''');
var t2 = JsonMapper.deserialize<Test>( '''{}''');
the value of t1 is always 4 which is not expected behavior. Expecting value should be 12.
the value of t2 is 4 which is correct since the value attribute's value is null.
Could we fix this or do I miss some configuration?
Say like we have a class like below with annotation defaultValue:
Then deserialize it use below code:
the value of t1 is always 4 which is not expected behavior. Expecting value should be 12. the value of t2 is 4 which is correct since the value attribute's value is null.
Could we fix this or do I miss some configuration?