Hi, This resembles the output of the Perl Data::Dumper function. I went ahead and use the first example from the JSON web site and first of all I noticed the XML examples are not well formed (syntactically), If you try to use those examples with an XML parser it'll fail to validate. I don't think thats it a fair thing to do exposing bad formed XML as an example to the corresponding JSON examples.
Json, I'll suggest to verify the syntax of the XML strings used as examples in the json web site. Either way, here's what I did: Perl code: #!/usr/bin/perl use Data::Dumper; use XML::Simple; my $string = <<EOF; <?xml version="1.0"?> <!DOCTYPE glossary PUBLIC "-//OASIS//DTD DocBook V3.1//EN" ""> <glossary><title>example glossary</title> <GlossDiv><title>S</title> <GlossList> <GlossEntry ID="SGML" SortAs="SGML"> <GlossTerm>Standard Generalized Markup Language</GlossTerm> <Acronym>SGML</Acronym> <Abbrev>ISO 8879:1986</Abbrev> <GlossDef> <para>A meta-markup language, used to create markup languages such as DocBook.</para> <GlossSeeAlso OtherTerm="GML"/> <GlossSeeAlso OtherTerm="XML"/> </GlossDef> <GlossSee OtherTerm="markup"/> </GlossEntry> </GlossList> </GlossDiv> </glossary> EOF print Dumper (XMLin($string)); Output of script: $ ./XML_Dump.pl $VAR1 = { 'GlossDiv' => { 'GlossList' => { 'GlossEntry' => { 'GlossDef' => { 'para' => 'A meta-markup language, used to create markup languages such as DocBook.', 'GlossSeeAlso' => [ { 'OtherTerm' => 'GML' }, { 'OtherTerm' => 'XML' } ] }, 'GlossTerm' => 'Standard Generalized Markup Language', 'ID' => 'SGML', 'SortAs' => 'SGML', 'Acronym' => 'SGML', 'Abbrev' => 'ISO 8879:1986', 'GlossSee' => { 'OtherTerm' => 'markup' } } }, 'title' => 'S' }, 'title' => 'example glossary' }; This way someone could source the code (perlish talking: eval) and just use it without any need of parsers. Regards, -Urivan Flores-Saaib ==============Original message text=============== On Fri, 06 Jul 2007 15:39:14 PDT "Jon Wahlmann" wrote: > > > We've had "win.ini" config file formats for years in the testing group > > and they are a PITA for anything other than simple configurations. > > Arrays and complex structures are ridiculous in the "win.ini" format > > Agreed. If there is a decent candidate for simpler > it is IMNSHO JSON. Well documented, has standard, > easy to read. There are parsers available in just > about any language you can think of. See > http://json.org/ I was wondering when someone would bring up JSON. I have to give a big +1 to JSON over XML or anything else. I've been using JSON over the past several months on a project here at work for exchanging data between various software components written in different languages. I really appreciate the (relatively) "lightweightedness" of JSON over XML. It makes for something that is very readable which I've come to appreciate when debugging. The json.org example page (http://www.json.org/example.html) is interesting inthat it compares JSON messages with their XML equivalents. Specifically, I have several Python scripts that are able to encode/decode JSON very easily since the JSON specification itself is essentially parsable Python. It's pretty cool to be able to read in some data and directly use it in the same manner, without any significant conversion. I haven't used it myself yet but I understand the json-c library is very easy to use. I understand it does reference counting so you only have to free the top node and everything else underneath is freed up for you. Not sure about data access there though but I'm guessing it is much easier than using some XML parser. There are also a number of JSON encoders/decoders available for Java. -Jon -- KPLUG-List@kernel-panic.org http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list ===========End of original message text=========== Urivan A. Flores Saaib CiberLinux Networking Email: [EMAIL PROTECTED] Web: www.ciberlinux.net -- KPLUG-List@kernel-panic.org http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list