if the example content is always the same... all is well... if it is often
different, simple access falls apart!
what if the code was a div instead of a p? or there was a different nesting?
On 5/22/07, Sean Catchpole <[EMAIL PROTECTED]> wrote:
Just as a note, the following code produces this
Just as a note, the following code produces this output: Author-Subtitle-
var json = {"p":{"b":"Title","i":"Subtitle","b":"Author"}};
for(x in json.p) document.write(json.p[x]+"-");
And the following code produces this output: Title,Author-Subtitle-
var json = {"p":{"b":["Title","Author"],"i":"S
Sean Catchpole wrote:
I really like json, and the ability to recognize arrays is great.
However, there is strength of xml in that order can be preserved. I
can not think of a way to implement this in json. Is it possible and I
am simply blind to the truth?
XML:
TitleSubtitleAuthor
JSON:
{"p":{
json is to JavaScript as xml is to the world as English is to Esperanto!
Way cool, but only understood and easily used by languages similar to
JavaScript (Perl, php, ...)
XML has no language dependencies, and is cool in it's own way.
Getting json to preserve order would be a pain, and is often
Jake,
A great idea, however the problem is how can JSON represent the order
correctly? Currently, it would output both "b" tags before the "i",
whereas the desired effect is to output the first "b", then the "i",
then the second "b" tag, in that order.
~Sean
P.S. The xml is just an example sce
What exactly does your XML schema represent? Is it just a form of stylized
markup, say b Bold, i Italicized? I'm pretty sure the for(x in y) loop will
maintain order of variables within a JSON string, reading off variables left
to right.
- jake
On 5/22/07, Sean Catchpole <[EMAIL PROTECTED]> wrot
6 matches
Mail list logo