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:

Get the O’Reilly Programming Newsletter

Weekly insight from industry insiders. Plus exclusive content and offers.

  • http://developer.yahoo.net/ Jeffrey McManus

    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.

  • http://raelity.org Rael Dornfest

    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

    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

    “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 :)

  • http://taint.org/ Justin Mason

    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…

  • http://www.williamsburger.com Chris Fairbanks

    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.

  • http://taint.org/ Justin Mason

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