Skip to content

JSON Path expression with many subscript operator is not returned values. #168

Open
@garciapacho

Description

@garciapacho

Describe the bug

JSON Path expression with many subscript operator is not returned values.

Code sample or steps to reproduce

JSON Sample:

{
  "id": "123456",
  "contactMedium": [
    {
      "type": "Telephone",
      "preferred": true,
      "characteristic": {
        "type": "Default",
        "contactType": "Default",
        "phoneNumber": "456123789"
      }
    },
    {
      "type": "Telephone",
      "preferred": false,
      "characteristic": {
        "type": "Home",
        "contactType": "Home",
        "phoneNumber": "987654321"
      }
    },
    {
      "type": "Telephone",
      "preferred": false,
      "characteristic": {
        "type": "Work",
        "contactType": "Work",
        "phoneNumber": "231654987"
      }
    },
    {
      "type": "Email",
      "preferred": false,
      "characteristic": {
        "type": "email",
        "contactType": "email",
        "emailAddress": "test@test.com"
      }
    }
  ]
}

JSON Path

$.contactMedium[?(@.type=='Telephone')].characteristic[ ?(@.type=='Home')].phoneNumber

Console error or logs

Expected behavior

It should return values with many subscript operators.

Expected result

[
  "987654321"
]

Environment (IMPORTANT)

https://jsonpath-plus.github.io/JSONPath/demo/?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions