Thu

Dec 15
2005

Rael Dornfest

Rael Dornfest

eval( '(' + YahooWebServices + ')' );

Our friend Jeff McManus over at the Yahoo! Developer Network clued us in to Y! Web Services now being available in a delicious new flavor: JSON--JavaScript Object Notation. Say bye-bye to XML parsing and the need for (very much) intermediary code when building Web 2.0 or single-page applications using Y!'s services and data. Simply fetch a wodge of JSON representing serialized results from Yahoo!'s servers, eval() (pronounced "evaluate") to turn it back into a JavaScript object, and your application is dealing with ordinary JavaScript objects. And even if you're not writing your code in JavaScript, there's most likely a JSON parser for your programming language of choice, allowing you to skip all the XML bits and get on with your application.

I can't tell you how useful a bootstrap it is--purists' shuddering at the thought of a language-specific encoding of data over the wire aside--to deal directly with data in a way your programming language (and application) understands. In May of 2000 when I released the Open API for our Meerkat RSS aggregator, I produced something similar in the form of a PHP-serialized objects.

Also, I've been meaning to mention Toni Schneider's P.S. on the latest Yahoo! Widgets (nee Konfabulator) featuring access to your personal Yahoo! (rather than just aggregate) data:

PS: Now that widgets can access personal user data such as Yahoo photo albums, calendars and address books it is possible for any developer to look at our new widgets and figure out how to tap into that data as well. However, please note that the calendar/address book/etc APIs that we’re using in these new widgets are not officially supported through the Yahoo Developer Network, so proceed at your own risk (or wait for the official APIs to come out).
Yahoo!—particularly their Yahoo! Developer Network, continues to open things up with abandon to third-party Web app developers willing to give the emerging Yahoo! platform a whirl.

tags: nitty gritty tech  | comments: 7   | Sphere It
submit:

 
Previous  |  Next

0 TrackBacks

TrackBack URL for this entry: http://blogs.oreilly.com/cgi-bin/mt/mt-t.cgi/4443

Comments: 7

  Jeffrey McManus [12.15.05 05:20 PM]

The purists will hopefully be OK with what we're doing since we're still providing the ability to go after the raw XML data if you want. This is just an accelerator that makes sense because in the browser, only one language matters -- Javascript.

  Rael Dornfest [12.15.05 05:26 PM]

Pure and simple are often not quite the same thing with the latter leading to interesting apps while the former still fiddles about with Hello, World. While the JSON will suit those writing one-page apps down to the ground, it's also a really nice way design from the outside in, going pure if and when needed.

(Hey Jeff, don't forget about that TCL browser plugin ;-)

  ravi [12.15.05 10:32 PM]

Hi
I was wondering if you could help me out in finding a tool or a way in which i can compare and find out the diffrences between two different schemas.I have an schema defined in the external system and the xml generated from it leads to an a smaller xml which has an diffrent schema defined in my C# .net code.Manually comparing them is a cumbersome process as well as prone to errors also.

Any Suggestions please do mail me or post them here.

Thanx
loginotavailable

  dennis [12.16.05 08:05 AM]

"I can't tell you how useful a bootstrap it is to deal directly with data in a way your programming language understands"...which I guess is why the Lisp people like their language so much :)

  Justin Mason [12.16.05 05:16 PM]

I like JSON a lot, but I have to say, the idea of throwing freshly-downloaded data directly into an eval(), without any parsing or validation, gives me the willies security-wise...

  Chris Fairbanks [12.19.05 06:49 AM]

You don't need to (and I'd never want to) run the code straight through an eval. There is an open source parser available at http://www.crockford.com/JSON/js.html which covers your back and keeps you safe from running arbitrary code. There are a lot of good resources there for other languages as well, although I've only had experience with the JavaScript code.

  Justin Mason [12.19.05 01:19 PM]

Chris -- perfect! thanks for that link, exactly what I was after.

Post A Comment:

 (please be patient, comments may take awhile to post)






Type the characters you see in the picture above.

RECOMMENDED FOR YOU

RECENT COMMENTS