Skip to content

Returning key of found object #46

Description

@bwl21

suppose I have

{
"a": {
   "v": "va"
    },
"b": {
   "v": "vb"
    }
}

$..[?(@.v=="va")] returns

[
{
	"v":"va"
}
]

how can I get the key of this object which is a ?

https://extendsclass.com/jsonpath-tester.html suports ~, such that $..[?(@.v=="va")]~ returns

[
"a"
]

How can I do this in JsonPath-PHP?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions