Skip to content

Implemented JsonNode#optional(...) methods #2150

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

Closed
wants to merge 1 commit into from
Closed

Implemented JsonNode#optional(...) methods #2150

wants to merge 1 commit into from

Conversation

burdoto
Copy link

@burdoto burdoto commented Oct 3, 2018

Closes #2145, though it might be wanted to add the methods #optional(String) and #optional(int) to the TreeNode in jackson-core.
If that is the case, let me know, and I will open PRs in both repositories.
This implementation is very rudimentary and uses the #path(...) methods, while checking with #isMissingNode() whether an empty optional should be returned.

@burdoto
Copy link
Author

burdoto commented Jan 28, 2019

Is this still a thing?

@cowtowncoder
Copy link
Member

@burdoto Apologies for missing this PR. I am actually thinking of this as part of bigger overhaul, listed on

https://github.com/FasterXML/jackson-future-ideas/wiki/Jackson3-Changes---JsonNode

to be converted into

https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-3

and related discussion under

FasterXML/jackson-future-ideas#36

(I am trying to figure a way to define light-weight specifications for larger changes)

@cowtowncoder
Copy link
Member

So: although I think this is a good idea in general, I think I'll do this as part of bigger set of changes described here:

FasterXML/jackson-future-ideas#36

So, thank you for contributing this; it will get in 3.0 in some form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add JsonNode.optional(String name) and JsonNode.optional(int index) to be able to get an Optional JsonNode
2 participants