If I have JSON such as
{
"blocks":[
{
"data":"yes",
"_class":"yes"
},
{
"data":"no",
"_class":"no"
}
]
}
and I want to retrieve the object that only has '_class' equal to 'yes', how do I use JSONPath-plus (https://www.npmjs.com/package/jsonpath-plus) to do that?
I've been trying
const blob = JSONPath('$.blocks[?(@._class === 'yes')]', jsonData);
but I get
ReferenceError: yes is not defined
Thanks for any help!
Be sure of your quotes and double-quotes when nesting strings.
is the correct answer (thanks @AVAVT)