Extract JSON data using JSON path

87 Views Asked by At

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

  1. query : extract label where key = value2
  2. 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.*/)]

0

There are 0 best solutions below