Stephan Schmidt: "Then our converter cannot detect that items is a list"
Right. XML is "looser" - it doesn't constrain child elements by design ahead of time (as long as you have the right processing rules). With JSON you have to know whether something is a sequence or not, upfront. Whether this extra coupling matters or not, I'm not sure - JSON isn't just a fat free alternative, it's an optimisation. One outcome is that JSON is never going to replace markup as a documentation format - its sweet spot is for sending down database results from servers.
That XML is (shock) well thought out was even a surprise to Lisp people, once - try catching missing end tag errors with sexprs sometime.
1 Comment
"One outcome is that JSON is never going to replace markup as a documentation format."
Seems so. The question remains how to generate XML and JSON from your REST backend. Convert both from database results? Convert both from domain objects? Convert JSON to XML? Convert XML to JSON? I'm not sure what's the best to do.
Generating XML is nice in Scala though, so the Scala -> XML -> JSON approach looks most DRY to me.
Peace
-stephan