1

The following code all returns False.

import jsonpath
data = {'layers': {'urlencoded-form.key': ["1234"]}}

assert jsonpath.jsonpath(data, '$..urlencoded-form.key') == False
assert jsonpath.jsonpath(data, '$..[urlencoded-form.key]') == False
assert jsonpath.jsonpath(data, '$..["urlencoded-form.key"]') == False
assert jsonpath.jsonpath(data, '$.."urlencoded-form.key"') == False
wgf4242
  • 775
  • 2
  • 11
  • 23
  • 1
    Does it work if you use quotes like this? "$..['urlencoded-form.key']" – Ada Aug 30 '23 at 13:34
  • 1
    Does this answer your question? [JSONPath Syntax when dot in key](https://stackoverflow.com/questions/40187231/jsonpath-syntax-when-dot-in-key) – jasonharper Aug 30 '23 at 13:35
  • It's not work either. – wgf4242 Aug 30 '23 at 13:36
  • 1
    perhaps it's a bug in the library, maybe try a different one... https://github.com/h2non/jsonpath-ng claims to be standards compliant – Anentropic Aug 30 '23 at 13:53
  • Putting it quotes the way @Ada commented is the correct way to reference these kinds of properties. That said, the third option in your code should work. I agree it's likely a bug. – gregsdennis Aug 30 '23 at 19:06

0 Answers0