Skip to content

Understanding difference between "@property=='<property_key>" and "@.<property_key>" #109

Open
@sankalpn

Description

@sankalpn

While trying out different filters, I noticed the following:

  1. Filtering with @Property works intuitively.
    JSONPath({ path: '$.[?(@property === "appName" && @ === "app1")]^', json: { "version": 1, "appName": "app1" }, wrap: false });
    The json passes filter and gets returned
    {"version":1,"appName":"app1"}
  2. The same thing with @.<property_name> filters out above json.
    JSONPath({ path: '$.[?(@.appName === "app1")]^', json: { "version": 1, "appName": "app1" }, wrap: false });
    This returns
    undefined

Is this behaviour expected? If yes, can we add a couple of more examples to documentation?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions