Having worked with SOAP/XML extensively at my past job I can say for web services I much prefer REST/JSON. JSON is much easier to work with and key value pairs make it much easier to get what you need. Parsing an XML tree can become a nightmare very quickly. > However, we’ve created another problem in the form of inconsistency: some user properties are represented as element attributes, others as child elements. Exac…
1. Why is parsing a tree which is encoded in JSON easier? 2. Why does it matter if an element is in an attribute or in child elements. You need some kind of schema anyway, right?
See this link on stack exchange[1].
[1] https://stackoverflow.com/questions/17604071/parse-xml-using...
> //Gets Street name xmlDoc.getElementsByTagName("street")[0].childNodes[0].nodeValue;
I’d much prefer something like jsonObj.address[0].street;. Personally I like to work with objects over parsing documents trees.