Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path not found when square Brackets inside of Path String #167

Open
Hugo2128 opened this issue May 23, 2022 · 1 comment
Open

Path not found when square Brackets inside of Path String #167

Hugo2128 opened this issue May 23, 2022 · 1 comment

Comments

@Hugo2128
Copy link

Describe the bug

Using a string with square brackets inside as Path returns undefind even if the Path is there.

Code sample or steps to reproduce

Example:

{
    "firstName": "John",
    "lastName": "doe",
    "age": 26,
    "address": {
        "streetAddress": "naist street",
        "city": "Nara",
        "postalCode": "630-0192"
    },
    "phoneNumbers [1]": [
        {
            "type": "iPhone",
            "number": "0123-4567-8888"
        },
        {
            "type": "home",
            "number": "0123-4567-8910"
        }
    ]
}

Now i want to get "phoneNumbers [1]" with

path: $..['phoneNumbers [1]'] or
path: $..'phoneNumbers [1]' or
path: $..phoneNumbers [1]

returns No Match

Expected result

[
  [
    {
      "type": "iPhone",
      "number": "0123-4567-8888"
    },
    {
      "type": "home",
      "number": "0123-4567-8910"
    }
  ] 
]

Environment (IMPORTANT)

  • JSONPath-Plus version: 6.0.1

Desktop**

  • Tested on OS: MacOS, Ubuntu 22.04
  • Firefox version 100.0.2 64-bit

Additional context

When removing the square brackets everything works fine even when replacing them curly braces or parentheses

@aodinok
Copy link

aodinok commented Dec 21, 2022

Can confirm it, have exactly the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants