I am using the following to extract JSON data using JSON path JSON example:
[
{
"key": "value1",
"label": "Auto - some random hash value..1"
},
{
"key": "value2",
"label": "Agro - some random hash value...2"
},
{
"key": "value3",
"label": "Auto - some random hash value...2"
},
{
"key": "valuen",
"label": "Textile - some random hash value...n"
}
]
I am trying to extract data value label in array index by applying condition to peers key in same index
- query : extract label where key = value2
- query : extract label where label starts with Auto
for query 2, I gave a try with following JSONPath but not getting expected result. $.[?(@.label =~ /^Auto.*/)]