We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi
I liked this gem, but it is not working for array of hashes. Or i am not sure if i am missing something.
require 'vine' require 'json'
json = '{ "name":"John", "address":{ "street":"street 1", "country":"country1" }, "phone_numbers":[ { "type":"mobile", "number":"234234" }, { "type":"fixed", "number":"2342323423" } ] }'
h = JSON.parse(json) {"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>[{"type"=>"mobile", "number"=>"234234"}, {"type"=>"fixed", "number"=>"2342323423"}]} a = h.access("phone_numbers.0.type") mobile b = h.set("phone_numbers.0.type", "tablet") {"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>{0=>{:type=>"tablet"}}}
{"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>[{"type"=>"mobile", "number"=>"234234"}, {"type"=>"fixed", "number"=>"2342323423"}]}
mobile
{"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>{0=>{:type=>"tablet"}}}
expected result is {"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>[{"type"=>"tablet", "number"=>"234234"}, {"type"=>"fixed", "number"=>"2342323423"}]}
{"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>[{"type"=>"tablet", "number"=>"234234"}, {"type"=>"fixed", "number"=>"2342323423"}]}
It is not working for array, or i am missing something. As documentation does not have any example for this Thanks
The text was updated successfully, but these errors were encountered:
@chengguangnan , is this set method with an array is part of the solution?
Sorry, something went wrong.
fixed a problem with List regards issue #5
572d67d
increased the version number
Hi @rkhapre ,
Sorry, just got your message. It should be fixed now. If you are using a Gemfile, try the latest version on github:
gem 'vine', github: 'chengguangnan/vine'
The commit is: 572d67d
No branches or pull requests
Hi
I liked this gem, but it is not working for array of hashes. Or i am not sure if i am missing something.
require 'vine'
require 'json'
h = JSON.parse(json)
{"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>[{"type"=>"mobile", "number"=>"234234"}, {"type"=>"fixed", "number"=>"2342323423"}]}
a = h.access("phone_numbers.0.type")
mobile
b = h.set("phone_numbers.0.type", "tablet")
{"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>{0=>{:type=>"tablet"}}}
expected result is
{"name"=>"John", "address"=>{"street"=>"street 1", "country"=>"country1"}, "phone_numbers"=>[{"type"=>"tablet", "number"=>"234234"}, {"type"=>"fixed", "number"=>"2342323423"}]}
It is not working for array, or i am missing something. As documentation does not have any example for this
Thanks
The text was updated successfully, but these errors were encountered: