Using JSON and Yahoo Answers
Posted by Chris @ 9:47 pm
My recent flurry of questions on Yahoo! Answers didn't have an alteriaulterior motive until about an hour ago, when I remembered Yahoo! released an API for Yahoo! Answers. The perfect API for my first foray into JSON!
The page I've created also listed as “Questions (using JSON data)” under code projects in the side nav, is a list of the questions I've asked pulled in from Yahoo! in real time. I've explained more about the technique used in the page, and it is below for reference. Suffice to say JSON is a really useful data format in the web developers arsenal, and it needs embracing much more by the web development community.
If you have any questions about JSON do ask away, and I'll do my best to answer or clarify what might not be obvious to the none Web 2.0 / AJAX developers out there.
“This is my first use of JSON. It loads the questions in from the Yahoo Answers API, specifying the output as JSON, and provides a function name for the callback. This functions is then executed, and as JSON is all JavaScript under the hood, it is instantly available as an object to add into the page's DOM as a list of questions.
For more information check out the Yahoo Developer pages, there are some security risks with using JSON the way I have from a data source you don't trust (unlike Yahoo), so read up on it first. Also take a look at the source of this page for an example of how its implemented in the real world!
All in all this was the quickest, easiest API I've ever implemented. I could have done the same thing with XML, but the fact that parsing the JSON output is so much easier, you'd be foolish not to look into it and try it out.”
3 Comments
Wednesday, August 23, 2006 10:42:00 am
One from the schoolteacher - what is this alteria? Do you mean ulterior? Is there a blogger's spellcheck out there?This comment posted by Anonymous
Wednesday, August 23, 2006 12:57:00 pm
Funny you should mention that. I did do the spell check in blogger, but it didn't pick up on it. But I wasn't sure it was right so I conducted a Google search for alteria, and enough sites came up with it used as I had spelled it for me to assume it was correct. However I now stand corrected, and have updated my post accordingly, ta!This comment posted by Chris
Wednesday, August 23, 2006 3:55:00 pm
Once again you have taught me something new, which I have passed on to my fellow devs. But did they have to call it Jason!?!?Anyway I have a question for you to Yahoo....
Does Chris Riley remind you of Dominic Burn from Radio 1's Chris Moyles Show (the news reader) ?!?!?
This comment posted by Anthony Main
Post a comment