Created
June 12, 2009 20:37
-
-
Save mperham/128903 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I assume this is valid UTF-8 encoded JSON | |
valid_json = '{ | |
"status": "ok", | |
"articles": [ | |
{ | |
"url": "http://www.idiomag.com/peek/85310/pearl_jam", | |
"confidence": 0.018548, | |
"published_datetime": "2009-06-02T12:04:19Z", | |
"zemified": 0, | |
"title": " Pearl Jam Debut \u00e2\u0080\u009cBackspacer\u00e2\u0080\u009d Track, Cover Art on Conan O\u00e2\u0080\u0099Brien\u00e2\u0080\u0099s \u00e2\u0080\u009cTonight Show\u00e2\u0080\u009d " | |
} | |
] | |
}' | |
require 'json' | |
hash = JSON.parse(valid_json) | |
puts hash['articles'][0]['title'] # print out the mucked-up title |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment