json_exporter icon indicating copy to clipboard operation
json_exporter copied to clipboard

JSON key with a dot ('.')

Open endotronic opened this issue 3 years ago • 1 comments

I think this issue is actually in the jsonpath library, so I opened an issue there, but I'm hoping someone here may know the answer. That issue is here: https://github.com/kubernetes/client-go/issues/1000

Imagine the following JSON: { 'one': 2, 'example.three': 'four', }

A query like ".one" or "$.one" works fine. However, I can't find a way to query for the second key. As I understand, "$.['example.three']" should do it, but this fails because it is interpreted as an array.

Is there any way I can escape the dot?

endotronic avatar Jul 29 '21 04:07 endotronic

Faced same issue, just escape dot with '\':

values:
    example: '{.example\.three}'

akosyrev avatar Aug 05 '21 06:08 akosyrev

Since the above solution works, I will close this issue.

rustycl0ck avatar Nov 30 '22 10:11 rustycl0ck