[Rails] Re: How to iterate an array of hashes and return the interested array

2011-09-05 Thread 7stud --
Well, it looks to me like you have an outer hash with key/values, and a value is an array of hashes, so you would do this: main_hash["items"][1]["title"] ==> 'xyz' main_hash["items"][1]["title"] ==> 'xyz' ^ ^ | | array | |

[Rails] Re: How to iterate an array of hashes and return the interested array

2011-09-05 Thread Dan Claudiu Pop
I already parsed the json call. The idea is that i want to access a certain hash within :item => [] or return the slug value for title => "xyz" On Sep 5, 7:39 pm, Everaldo Gomes wrote: > Take a look at this,http://developer.yahoo.com/ruby/ruby-json.html > > > > > > > > On Mon, Sep 5, 2011 at 1:35

Re: [Rails] Re: How to iterate an array of hashes and return the interested array

2011-09-05 Thread Everaldo Gomes
Take a look at this, http://developer.yahoo.com/ruby/ruby-json.html On Mon, Sep 5, 2011 at 1:35 PM, 7stud -- wrote: > That isn't valid ruby syntax. Are you trying to parse a file with that > syntax? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you a

[Rails] Re: How to iterate an array of hashes and return the interested array

2011-09-05 Thread Ray Parker
my_array.select{|item| item[:key] == my_criterion} ..will give you an array of items that meet your needs if the 'item' is a hash. On Sep 5, 12:35 pm, 7stud -- wrote: > That isn't valid ruby syntax.  Are you trying to parse a file with that > syntax? > > -- > Posted viahttp://www.ruby-forum.com/

[Rails] Re: How to iterate an array of hashes and return the interested array

2011-09-05 Thread 7stud --
That isn't valid ruby syntax. Are you trying to parse a file with that syntax? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroup