Possible Duplicate:
Parsing a JSON string in ruby
I've managed to get a bunch of json into a variable in ruby and print it out, through the JSON gem and the following code:
require 'open-uri'
require 'json'
result = JSON.parse(open("https://api.pinboard.in/v1/posts/get?auth_token=username:token&tag=fashion&meta=yes&format=json").read)
puts result
What it returns is this:
{
"date"=>"2012-09-24T03:35:38Z",
"user"=>"username",
"posts"=>[{
"href"=>"http://example.com/example.jpg",
"description"=>"this is the description",
"extended"=>"A full, longer description.",
"meta"=>"d6f967c9adfbe1eb3763fddbcd993d1b",
"hash"=>"a46e0e7202d9d56c516a472d8be70d9e",
"time"=>"2012-09-24T03:35:38Z",
"shared"=>"yes",
"toread"=>"no",
"tags"=>"fashion"
}
]}
(the line-spacing here is mine, for clarity)
My problem is, I have no idea how to access these keys and values! I've googled and searched but I'm really new to ruby and I'm having a lot of trouble figuring out exactly what I'm supposed to be doing, nevermind the code to do it. Help?