joshbuddy/jsonpath

Not possible to access values of numeric keys

Closed this issue · 3 comments

Hello!

I just stumbled upon an issue that it's not possible to access values of numeric keys. Let's say we have a following json, while trying to access 1 key, nil gets returned:

data = {
  "1": "foo"
}
JsonPath.new("$.1").on(data.to_json)
# => [nil]

Hi @mbajur. Thanks for reporting. I found the "bug". I reluctantly call it a bug, because I have no idea why it was there in the first place. :D And all the tests seem to be working even if we don't cast the key to an Integer. So here's to hoping nothing other broke.. :D

i'm glad you nailed it that easily :) thanks!

Released the fix. Cheers!