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

Error thrown when using square brackets to access property at the root of the JSON #258

Copy link
Copy link
@settergren

Description

@settergren
Issue body actions

Describe the bug

An exception is thrown when using square brackets to access properties at the root of an object.

Code sample

const data = {
  "@id": "test"
}

JSONPath({json: data, path: "$['@id']", wrap: false});

Console error or logs

TypeError: Unknown value type

Expected behavior

I should be able to select attributes at the root of an object that start with special characters such as "@id"

Expected result

In the example above I expect to get "test" as a result

Environment (IMPORTANT)

"jsonpath-plus": "^10.4.0",

Desktop**

  • Windows
  • Chrome 145.0.7632.118

Extra Info

This works when accessing a nested object (For example, "$.foo['@id']")

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.