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
I'm confused with setup in "Usage section":
ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.registerModule(new JsonNullableModule());
Please take a look on the following snippet ( val=null is passed in JSON and in Map):
val=null
record A (JsonNullable<BigDecimal> val) {} ObjectMapper objectMapper = new ObjectMapper().registerModule(new JsonNullableModule()); A a1 = objectMapper.readValue("{ \"val\" : null }", A.class); System.out.println(a1); HashMap hashMap = new HashMap(); hashMap.put("val", null); A a2 = objectMapper.convertValue(hashMap, A.class); System.out.println(a2);
Output is consistent
A[val=JsonNullable[null]] A[val=JsonNullable[null]]
But with setup
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JsonNullableModule()) .setSerializationInclusion(JsonInclude.Include.NON_NULL);
Output is not consistent
A[val=JsonNullable[null]] A[val=JsonNullable.undefined]
Well, time for questions:
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
objectMapper.convertValue
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm confused with setup in "Usage section":
Please take a look on the following snippet (
val=null
is passed in JSON and in Map):Output is consistent
But with setup
Output is not consistent
Well, time for questions:
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
. It looks useless.objectMapper.convertValue
is deserialization)The text was updated successfully, but these errors were encountered: