jmespath.js icon indicating copy to clipboard operation
jmespath.js copied to clipboard

Recursive traversal missing

Open kvetoslavnovak opened this issue 3 years ago • 8 comments

First of all thank you very much for this great library which helped us with our project a lot!!!

Only feature that we really miss is that JMESPath doesn't have recursive traversal. Like the standard feature // in XPath or .. in JsonPath.

Thank you very much for your response

kvetoslavnovak avatar Dec 01 '21 08:12 kvetoslavnovak

Can you give a use case? or example of what you're trying to achieve?

darrenmothersele avatar Dec 08 '21 20:12 darrenmothersele

@kvetoslavnovak I believe the let() function coming to JMESPath Community sort of does what you want.

springcomp avatar Aug 09 '22 10:08 springcomp

Can you give a use case? or example of what you're trying to achieve?

E.g. I am trying to get all TYPE_OF_DATE tags/nodes which are all over the different places in my XMLs. Using JSONPath library for the time being. Example of my code:

  // using JSONPath to get all TYPE_OF_DATE  because JMESPath cannot do recursive traversal (to get non-rooted expressions)
   let TYPE_OF_DATE = JSONPath({
     path: "$..TYPE_OF_DATE",
     json: JSONfile,
   });

Description of // XPath selector is for example here W3School - XPath Syntax

kvetoslavnovak avatar Sep 28 '22 11:09 kvetoslavnovak

@kvetoslavnovak I believe the let() function coming to JMESPath Community sort of does what you want.

Thank you very much for this tip.

kvetoslavnovak avatar Sep 28 '22 11:09 kvetoslavnovak

@springcomp thank you for the let()tip. But it does not seem to be exactly the right tool nor as easy to use as the others // or .. recursive traversal child selectors usually are.

kvetoslavnovak avatar Jan 01 '23 07:01 kvetoslavnovak

@kvetoslavnovak I‘ve setup #148 to track this feature.

springcomp avatar Jan 01 '23 09:01 springcomp

@springcomp thank you very much

kvetoslavnovak avatar Jan 01 '23 17:01 kvetoslavnovak

@kvetoslavnovak We want to propose this feature to JMESPath and will include this in the next iteration for JMESPath Community.

springcomp avatar Jun 24 '23 07:06 springcomp