Skip to content

Support for OR (||) operator? #49

@johnallen3d

Description

@johnallen3d

I've tried a few things based on suggestions in this post but am having no luck. Obviously there are many different implementations of JSONPath so I'm wondering if this one has support for an OR operator.

As an illustration, the following example works with the online evaluator:

// JSON
{
  "firstName": "John",
  "phoneNumbers": [
    {
      "type"  : "iPhone",
      "number": "0123-4567-8888"
    },
    {
      "type"  : "home",
      "number": "0123-4567-8910"
    }
  ]
}
// query
$.phoneNumbers[?(@.type == 'home' || @.type == 'iPhone')]
// desired output
[
  {
    "type": "iPhone",
    "number": "0123-4567-8888"
  },
  {
    "type": "home",
    "number": "0123-4567-8910"
  }
]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions