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

Path with a string that starts with a numeral throws an error

Open caguthrie opened this issue 2 years ago • 1 comments

Using jmespath 0.15.0

This crashes with error jmespath.js:501 Uncaught ParserError: Unexpected token type: Number, value: 15

search({ foo: { '15bar': 'baz' } }, 'foo.15bar')

How can I access keys if they start with numbers?

caguthrie avatar Mar 21 '23 15:03 caguthrie

You need to use a quoted-identifier :

  • foo."15bar"

springcomp avatar Jun 19 '23 20:06 springcomp