-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
3.0Issue planned for initial 3.0 releaseIssue planned for initial 3.0 release3.0-release-notesIssues relevant for 3.0 release notes.Issues relevant for 3.0 release notes.
Milestone
Description
(note: similar to #5003 but for non-numbers)
Jackson 2.x has methods like JsonNode.asBoolean()
to allow some additional coercions from types not directly compatible (boolean
only assignable from JSON Booleans):
asBoolean()
similar tobooleanValue()
but allows coercion from (compatible)String
, as well as null and integer numbers. But if not, throw exceptionasBooleanOpt()
likeasBoolean()
but returnsOptional<Boolean>
, either present (as perasBoolean()
) or absent (instead of exception)
but as with JsonNode.xxxValue()
methods like booleanValue()
, no exception is thrown but quietly default value (like false
for boolean
) is returned. For Jackson 3.0 we have unchecked JsonNodeException
so let's use that instead.
We can also clarify coercions that are allowed, as well as extend set of asXxx()
methods as it makes sense.
Relevant types/methods:
asBoolean()
asString()
Do we need to add any more?
asBinary()
?
Metadata
Metadata
Assignees
Labels
3.0Issue planned for initial 3.0 releaseIssue planned for initial 3.0 release3.0-release-notesIssues relevant for 3.0 release notes.Issues relevant for 3.0 release notes.