From: Robert Klemme Date: 2011-10-12T20:52:48+09:00 Subject: Re: how to parse yaml object ? On Wed, Oct 12, 2011 at 12:51 PM, Rajesh B. wrote: > i am new to yaml. > > I have this yaml object to display in view page can any one help me how > to parse it and display in view page.! > > for example i have to display :message => "xxxx" from this object in > view page. > > > > [{"data"=># @ivars={"table"=>{:last_assignment_id=>nil, :created_at=>Wed Oct 12 > 09:22:27 UTC 2011, :context_code=>"course_125", :type=>"Announcement", > :root_discussion_entries=>[], :posted_at=>Wed Oct 12 09:22:27 UTC 2011, > :deleted_at=>nil, :podcast_has_student_posts=>false, > :old_assignment_id=>nil, :cloned_item_id=>nil, :context_id=>125, > > :message=>"

hai this is an announcement from e-learning module > .!!!

\n

#ffffff;\">successfully working ...!!!

", > > :could_be_locked=>nil, :podcast_enabled=>false, :position=>1, > :last_reply_at=>Wed Oct 12 09:22:27 UTC 2011, :workflow_state=>"active", > :assignment_id=>nil, :root_topic_id=>nil, :updated_at=>Wed Oct 12 > 09:22:27 UTC 2011, :subtopics_refreshed_at=>nil, > :context_type=>"Course", :total_root_discussion_entries=>0, > :attachment_id=>nil, :context_short_name=>"MM-II", > :external_feed_id=>nil, :id=>4, :editor_id=>nil, :user_id=>1, > :delayed_post_at=>nil, :require_initial_post=>false, > :title=>"announcement for sis application ", > :user_short_name=>"rajesh.13kits@gmail.com", :migration_id=>nil}}>, > "created_at"=>Wed Oct 12 09:22:28 UTC 2011, > "item_asset_string"=>"discussion_topic_4", "updated_at"=>Wed Oct 12 > 09:22:28 UTC 2011, "id"=>24, "user_id"=>nil, > "context_code"=>"course_125"}] > > > Please help me.. > Thanks in advance. Difficult when one does not have the code that produces this. I'd try msg = a[0]["data"].ivars["table"][:message] Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/