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

Allow all array elements in JsonPointerBasedFilter #1036

Merged
merged 2 commits into from May 23, 2023

Conversation

cowtowncoder
Copy link
Member

@cowtowncoder cowtowncoder commented May 23, 2023

(note: re-created #1026 against 2.16).

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"
         }
      ]
   }
]

@cowtowncoder cowtowncoder merged commit e85e2d5 into 2.16 May 23, 2023
5 checks passed
@cowtowncoder cowtowncoder deleted the tatu/2.16/filter-arrays-1026 branch May 23, 2023 00:35
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.

None yet

1 participant