Find a JSON property name that starts with something using JSON Path
From my googling this is not possible in standard json path
. However, the jsonpath-plus package extends the specification with @path
; and makes the following possible
$..[?(@path.includes("[\'x-"))]
$..*[?(@property === 'price' && @ !== 8.95)]
The above assumes you are using ES6.
Useful to someone else
You can use regular expression using =~ left matches regular expression. For more in formation visit https://github.com/jayway/JsonPath
[?(@.name =~ /foo.*?/i)]