Skip to content

Conversation

DemonicTutor
Copy link
Contributor

@DemonicTutor DemonicTutor commented May 17, 2023

Currently JsonPointerBasedFilter only processes Json Arrays by index. eg /0/id.

With this change it is possible to extract all elements using a pointer in the form of //id:

source:

[
   {
      "id":1,
      "stuff":[
         {
            "name":"first",
            "type":"a"
         },
         {
            "name":"second",
            "type":"b"
         }
      ]
   },
   {
      "id":2,
      "stuff":[
         {
            "name":"third",
            "type":"c"
         },
         {
            "name":"fourth",
            "type":"d"
         }
      ]
   }
]

pointers:

"//id"
"//stuff//name"

result:

[
   {
      "id":1,
      "stuff":[
         {
            "name":"first"
         },
         {
            "name":"second"
         }
      ]
   },
   {
      "id":2,
      "stuff":[
         {
            "name":"third"
         },
         {
            "name":"fourth"
         }
      ]
   }
]

@pjfanning
Copy link
Member

Any chance you could target at branch 2.16? master branch is for a 3.0 release that is probably a long way away? Jackson 2 uses com.fasterxml.jackson instead of tools.jackson package?

@cowtowncoder cowtowncoder added the 2.16 Issue planned (at earliest) for 2.16 label May 17, 2023
@cowtowncoder
Copy link
Member

cowtowncoder commented May 17, 2023

Right, +1 for targeting 2.16 for reasons @pjfanning mentioned. Would be happy to merge (assuming CLA handled -- added a label as I am not 100% if you provided one; if you did that's fine I can check later on)

@cowtowncoder cowtowncoder added cla-needed PR looks good (although may also require code review), but CLA needed from submitter and removed cla-needed PR looks good (although may also require code review), but CLA needed from submitter labels May 17, 2023
@cowtowncoder
Copy link
Member

Checked it: yes, we do have CLA. So that's not a problem.

@cowtowncoder
Copy link
Member

cowtowncoder commented May 19, 2023

@DemonicTutor Would be happy to merge but I think we'd really like this against 2.16 branch.

Could you create a new PR?

@cowtowncoder
Copy link
Member

Merged via #1036 to 2.16.

@DemonicTutor
Copy link
Contributor Author

ah awesome! thanks @cowtowncoder for handling that for me :)

@cowtowncoder
Copy link
Member

Np @DemonicTutor !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.16 Issue planned (at earliest) for 2.16
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants