Slide 37
Slide 37 text
json = '{
"id":8,
"email":"foo@bar.com",
"posts":[
{"id":30, "title":"First Post", "body":"Some text..."},
{"id":73, "title":"Second Post", "body":"More text..."}
]
}'
user = User.new.from_json(json)
user.email # => foo@bar.com
user.posts.size # => 2
user.post.first.title # => "First Post"
Data Format (JSON & XML)
Monday, September 12, 11