Skip to content

Returning key of found object #46

@bwl21

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?

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