Skip to content

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

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.

1 participant