Wednesday, August 22, 2007

JSON is Kewl


While messing around with the new fangled reference parser script that connects to bioGUID to get the goods, it occurred to me that this slick, simple technique that requires next to no mark-up, can be applied to all sorts of nifty things. Yahoo produces JSON for its search results and you can specify your own callback function. So, for kicks, I adjusted my JavaScript file a bit to use Yahoo instead of Rod Page's bioGUID reference parser and also added some cool DHTML tooltips developed by Walter Zorn. So, hover your mouse over a few animal and plant names that I list here with no particular relevance: Latrodectus mactans, Blue Whale, blue fescue, and, Donald Hobern's favourite, Puma concolor. Incidentally, I may as well try it with Donald Hobern himself (Disclaimer: I take no responsibility for what may pop-up in the tooltip). Now that I have been messing with this JavaScript for pulling JSON with a callback, this stuff is quite exciting. You have to remember that there is next to NO mark-up or any additional effort for someone to take advantage of this. I only have a few JavaScript files in the <body> section of this page and I mark-up the stuff I want to have a tooltip with <span class="lifeform">name here</span>. This is pretty cool if I do say so myself.
I initially tried this technique with Flickr, but they don't permit square brackets in a callback function. So, I wrote the developers and alerted them to this cool new toy. Hopefully, they'll open the gates a little more and not be so restrictive.

Forgive me...I just can't help myself:
Carabus nemoralis
Argiope aurantia
Culex quinquefasciatus
duck-billed platypus
slime mould
...How many more million to go?...

1 comment:

David Shorthouse said...

Felt the need to comment on my own post...
JSON is indeed fun to play with, but there is such a close tie between client and one server that it is tough to do anything beyond simple little gadgets like this. Sure, you can produce and consume JSON much like you can XML, but in terms of the Semantic Web world, this is a bit of step backwards. So, it also occurred to me that this technique may help to build RDF triples for the provider. For example, it's a snap to grab the parent URL in JavaScript. Why not program a behind-the-scenes JSON POST in the gadget (you'd likely want to issue keys) such that clicking a URL in a tooltip sends the URL/title/description of the page to the server? Think of this as user-generated tags & associations on the server when a user merely clicks a link in the tooltip. So, the server could very quickly establish site presence & also have a ready-made mechanism to generate a huge RDF triple store. A server/provider of the JavaScript would just have to have a compelling reason for a page developer to put this script on their pages and modify their mark-up a bit. URL voting on the server a la Digg perhaps to drive more traffic back to the page developer's site/page?