Today , I stumbled upon this article.
An elaborate XML to JavaScript code , done by some talented M$FT developer.
I wanted to share it with you. Why? Because I think of it as a nice example telling us clearly why is JSON so much better than XML. It all starts with this XML as an example:
I got immediately and intensely wondering, why not just ‘store’ these books like this :
1 2 3 4 5 6 |
/* BookList */ [ { Author: "Paul", Price : 10.30 } , { Author: "Joe", Price : 20.95, Title: "Web 2.0" } ] ; /**/ |
How superior… So, I have to ask again: Why XML ?
2008-12-12 Update
Proper JSON to XML , without any loss of information would be :
1 2 3 4 5 6 7 8 |
/**/ { BookList : [ { Author: "Paul", Price : 10.30 } , { Author: "Joe", Price : 20.95, Title: "Web 2.0" } ] } /**/ |
This when stored does not loose any information that was in XML.
DBJ