JSONPath-Plus / JSONPath

A fork of JSONPath from http://goessner.net/articles/JsonPath/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

garciapacho opened this issue · comments

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/?