json-lenses icon indicating copy to clipboard operation
json-lenses copied to clipboard

Jsonpath: support && and ||

Open Amerousful opened this issue 3 years ago • 2 comments

I am faced with the fact that some operations are not currently supported in JsonPath. I have query like this:

$.[?(@.id=='1' && @.name == 'Pasha')]

I see that this project has not been updated for a long time... Do you have any plans to support this project?

Amerousful avatar Jul 20 '21 16:07 Amerousful

I'm not planning any new development myself right now but I'm fine with releasing new versions if there are contributions to be released.

This feature should be relatively easy to add, so I'd be happy to look at a PR and release a new version when needed.

jrudolph avatar Jul 20 '21 18:07 jrudolph

You would need to introduce new classes

case class And(p1: Predicate, p2: Predicate) extends Predicate
// same for or

in JsonPath.scala, then add a parser for that in JsonPathParser.scala, and an implementation/conversion in JsonPathIntegration.scala.

jrudolph avatar Jul 20 '21 18:07 jrudolph