Skip to content

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

Open
@marciondg

Description

@marciondg

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions