Skip to content
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

Add method(s) in JsonNode that works like combination of at() and with(): withObject(...) and withArray(...) #1980

Closed
cowtowncoder opened this issue Mar 23, 2018 · 0 comments
Milestone

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented Mar 23, 2018

Currently one can either:

  1. Locate a descendant node using at() OR
  2. Traverse immediate children, if one exists, or add one if not using with() and withArray()

but not something that would combine utility. But perhaps it would be enough to overload with() to take JsonPointer, and work similar to with except possible create longer path.
We might as well overload withArray() as well.

This will supercede #393.

EDIT: let's call methods withObject() and withArray() to indicate the expected node type to create. It will also be necessary to indicate allowed "replacement mode" in possible case of existing path being incompatible (f.ex expected path node being a scalar value), to determine whether to Replace the existing node (with Object/Array) or throw exception.

@cowtowncoder cowtowncoder added 2.14 and removed 3.x labels Jun 7, 2022
cowtowncoder added a commit that referenced this issue Jul 4, 2022
cowtowncoder added a commit that referenced this issue Jul 4, 2022
cowtowncoder added a commit that referenced this issue Jul 6, 2022
@cowtowncoder cowtowncoder changed the title Add method(s) in JsonNode that works like combination of at() and with() Add method(s) in JsonNode that works like combination of at() and with(): withObject(...) and withArray(...) Jul 28, 2022
@cowtowncoder cowtowncoder added this to the 2.14.0 milestone Jul 28, 2022
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

No branches or pull requests

1 participant