We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@JsonSetter
Hi
We are testing FastJson2 in a spring-boot based application and we have a DTO with the @JsonSetter annotation and it is being ignored.
FastJson2
import static org.assertj.core.api.Assertions.assertThat; import com.alibaba.fastjson2.JSON; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; public class JsonSetterTest { @Test public void testJsonSetter() throws Exception { // given final String json = "{ \"department\": \"IT\" }"; // when final ObjectMapper mapper = new ObjectMapper(); final JsonSetterDTO jackson = mapper.readValue(json, JsonSetterDTO.class); final JsonSetterDTO fastJson2 = JSON.parseObject(json, JsonSetterDTO.class); // then assertThat(jackson.getDept()).isEqualTo(fastJson2.getDept()); } static class JsonSetterDTO { @JsonSetter("department") String dept; public String getDept() { return this.dept; } public void setDept(final String dept) { this.dept = dept; } } }
Result jackson
jackson = {JsonSetterTest$JsonSetterDTO@2462} dept = "IT"
Result fastjson2
fastJson2 = {JsonSetterTest$JsonSetterDTO@2463} dept = null
Thank you very much
The text was updated successfully, but these errors were encountered:
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.51-SNAPSHOT/
The BUG has been fixed. Please help verify it with version 2.0.51-SNAPSHOT
Sorry, something went wrong.
support jackson annotation JsonSetter, for issue #2643
1d0693f
Fixed! Thank you very much
https://github.com/alibaba/fastjson2/releases/tag/2.0.51 Please use the new version 2.0.51
No branches or pull requests
Hi
We are testing
FastJson2
in a spring-boot based application and we have a DTO with the@JsonSetter
annotation and it is being ignored.Result jackson
Result fastjson2
Thank you very much
The text was updated successfully, but these errors were encountered: