why is embedding JSON in XML bad? -


My stomach tells me that it is wrong to put one format in another, but I do not seem to come for substantial reasons.

& lt; Root & gt; & Lt; Accessories & gt; Talk & lt; / Stuff & gt; & Lt; More & gt; & Lt; [CDATA [{"one": ["b", "c"]}!]] & Gt; & Lt; / More & gt; & Lt; / Root & gt;

Just put it in XML

   

Two segments are going to be parsed by a rationally different code, but as an interchange format, is it okay to mix mix and syntax?

Does your answer change if we have an existing ending point that parses JSON response? We have to remember this endpoint for XML ingestion.

By using two formats, additional loads as an exchanging form are those people You want to inter-operate with you now they need the XML parser and a JSON parser.

It also makes it difficult for people to mess with the format, because they have to switch gears while thinking differently to parts of your file.

In the end, you will not be able to easily do those things which look at the entire structure at once. For example, you can not use XPath to catch JSath bits, nor can you treat the entire response in the form of a javascript object.

By combining two formats, you get the "worst of both worlds" problem when it connects the data.

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -