How to parse yaml object?

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”=>#<YAML::Object:0x102df5388 @class=“OpenObject”,
@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

<span style=“background-color: #339966; color:
#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=>“[email protected]”, :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.

On Wed, Oct 12, 2011 at 12:51 PM, Rajesh B. [email protected]
wrote:

[{“data”=>#<YAML::Object:0x102df5388 @class=“OpenObject”,
:could_be_locked=>nil, :podcast_enabled=>false, :position=>1,
“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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs