-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
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
Enable default values for text nodes #463
Comments
Sounds reasonable to me. One question is as to when this should be used: with primitives, value is used if no coercion is found. But with Strings, most other types would convert to String. So should this only use default value if property is missing altogether? Or if it does not have scalar value (i.e. missing property, as well as array/object valued, would use default). |
My thought was that the default value should be returned only when the On 5/19/2014 6:59 PM, Tatu Saloranta wrote:
Chris Cleveland This email and any attachments contain information from Dieselpoint, |
Implemented: will return
but note that it is NOT returned if empty String ("") is available. |
Hi, bit late to the party but anyway: after upgrading to the latest Jackson databind release I noticed a deprecation warning when using
It says that almost no node type did ever return
So the
That returned "default value" for an empty JsonNode.
or
I have two questions:
Kind regards |
Follow-up discussion on #4471. |
When a JsonNode contains an integer or boolean, there's a nice option to specify a default value:
int myInt = myNode.asInt(defaultValue);
This doesn't exist for text nodes. It would be nice to have this:
String myString = myNode.asText("a default value here");
The text was updated successfully, but these errors were encountered: