jmespath.js icon indicating copy to clipboard operation
jmespath.js copied to clipboard

How to access where attribute begins with a number?

Open dukedougal opened this issue 8 years ago • 3 comments

consider this:

var x = {} x.y = {} x.y['3av'] = 'hello'

How can I access x.y.3av using jmespath? It returns an error no matter what I try.

dukedougal avatar Oct 14 '17 03:10 dukedougal

please try 'x.y."3av"'

dshvedchenko avatar Nov 08 '17 15:11 dshvedchenko

The implication of this is that if I'm dynamically constructing my search strings - which I usually am - then I need to quote every level.

Isn't this edge case is better suited to happening inside the library?

dukedougal avatar Nov 10 '17 20:11 dukedougal

I think you can apply it only to cases where your literal starts from digit.

dshvedchenko avatar Nov 11 '17 09:11 dshvedchenko