Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbolize_keys option doesn't work as the README says #162

Open
marciondg opened this issue Aug 1, 2023 · 1 comment
Open

symbolize_keys option doesn't work as the README says #162

marciondg opened this issue Aug 1, 2023 · 1 comment

Comments

@marciondg
Copy link

marciondg commented Aug 1, 2023

Hi everyone!
Checking the README I found this interesting option

image

However, when I tested it in my project, it didn't work as expected

image

Looking over the implementation, I detected that it uses a symbolize_keys expected in the on options, ignoring the sent during the initialization.

jsonpath/lib/jsonpath.rb

Lines 79 to 87 in 4e31ac9

def on(obj_or_str, opts = {})
a = enum_on(obj_or_str).to_a
if opts[:symbolize_keys]
a.map! do |e|
e.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }
end
end
a
end

So, I tried as follows and it worked!
image

Should the documentation be modified or rather the implementation?
Thanks!

@anupama-kumari
Copy link
Contributor

anupama-kumari commented Oct 10, 2023

I have tried to fix above issue, kindly check @joshbuddy

#165

joshbuddy added a commit that referenced this issue Oct 12, 2023
#162 : symbolize_keys option doesn't work as the README says
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants