To address your earlier comment about standards, I'd like to point out that
object literals are part of the JavaScript language which is an ECMA
standard.

I'm consuming my own data with JavaScript so I prefer to format it in a way
that's directly evaluated by the language. The main reason XML would have
worked -- not as well now that I've had to recall some memories -- is that
the Google Maps API has a method for serializing XML map data. My map's data
is encapsulated in the BUnits object without having to worry about
deserializing. I have one general handler for the entire map that is
triggered when a click event occurs. If the click is a marker then the
infowindow is built from the corresponding city object in BUnits.

For the purposes of data-interchange there's a formalized explanation at
http://json.org/ with diagrams and code examples of more secure parsers.
Personally, when dealing with business partners I'm happy to go along with
whatever they have -- within reason -- so I'm not as big on evangelizing
JSON for inter-company communications.

On Mon, Apr 28, 2008 at 2:47 PM, Maurice O'Prey <maurice.oprey@xxxxxxxxx>
wrote:

Alfredo

Well I have to take my hat off to you for providing a working example,
impressive. However as you say XML would also have worked??

Other than size of payload why go JSON?

Maurice


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Alfredo Delgado
Sent: 28 April 2008 19:26
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] XML and JSON

This example isn't really AJAX but it's using JDE address book data out of
DB2 to be utilized in JavaScript. XML would have also worked.

1. There's a SQL query.
2. I wrote what I consider to be an ad hoc JSON view of the data in PHP. (
http://www.lairdplastics.com/locations/dsp_GetBusinessUnits.js.php)
3. That data structure is included as external JS source along with the
Google Maps API here: http://www.lairdplastics.com/content/section/4/39/
4. Same query, different view:
http://www.lairdplastics.com/content/section/16/55/

On Mon, Apr 28, 2008 at 2:01 PM, Maurice O'Prey <maurice.oprey@xxxxxxxxx>
wrote:

Would it be too much to ask for a description of a 'real world'
implementation of JSON, one where XML and web services would not fit nor
perform very well?

I don't doubt the usefulness of JSON, I just need to learn by example
(and
learn to live within standards)

Maurice O'Prey


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On
Behalf Of Joe Pluta
Sent: 28 April 2008 18:21
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] XML and JSON

Walden H. Leverich wrote:
If this is a true webservice with WSDL and all that, than the payloads
are XML, and usually with children not attributes. As Joe mentioned,
it's definitely "efficiency challenged" (nice phrase), but it's also
the
simplest, and there's something to be said for simplicity when working
between machines and technologies.

If the response is for an Ajax request then we go the JSON approach.
Not
only because the size is (typically) smaller, but because it's really
nice to be able to rehydrate a complete object graph on the browser
with
a simple eval statement (or in our case Prototype's
Ajax.Response.responseJSON property)

I don't know that I call SOAP simpler than JSON, but it's more
standardized, I guess. It's just that the majority of the standarized
junk is pretty useless in many circumstances, primarily the Ajax type of
request. As Walden points out, JSON is designed specifically for quick
movement of data between machines - structures on the wire. This is the
part that I've had to rewrite so many times over the years, and its
amazing how little work it is with JSON.

Joe
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.




--
Alfredo Delgado / Web Development
6800 Broken Sound Pkwy; Suite 150
Boca Raton, Florida 33487
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.