Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@Hugo2128

Description

@Hugo2128
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.