0

I'm trying to write a simple JSON path query

oc get pa -o jsonpath='{range.data[*]}{@.data.vpa.pa\.poc\.hpa\\/value}{"\n"}{end}'

"data" [
      {
      "vpa"
       {
"pa.poc.hpa/value" : 20
}
}
]

from above JSON trying to get 20

 "pa.poc.hpa/value" : 20

i'm trying to pull 20 using below, but not getting value . giving empty results

pa\.poc\.hpa\\/value
kiran k
  • 41
  • 8

1 Answers1

2

I don't recognize the {} syntax you're using.

A proper JSON Path would be

$.data[*].vpa['pa.poc.hpa/value']

The [*] would search all of the items in the data array.

Because you have a non-standard property name pa.poc.hpa/value you need to use the bracket syntax with the property name in quotes.

gregsdennis
  • 7,218
  • 3
  • 38
  • 71