My gut tells me that putting one format in another is wrong, but I can’t seem to come up with concrete reasons.
<root>
<stuff>
thing
</stuff>
<more>
<[!CDATA[{"a":["b","c"]}]]>
</more>
</root>
versus just putting it in the xml
<root>
<stuff>
thing
</stuff>
<more>
<a>
b
</a>
<a>
c
</a>
</more>
</root>
The two sections are logically going to be parsed by different code, but as an interchange format, is it ok to mix and match syntax?
Does your answer change if we have an existing endpoint that parses the JSON response? We would have to recode this endpoint for XML ingestion.
As an interchange format using two formats puts extra burden on people who want to inter-operate with you. Now they need to have an XML parser and a JSON parser.
It also makes it harder for people to grok the format, as they have to mentally switch gears when thinking about different parts of your file.
Finally, you won’t be able to easily do things that look at the entire structure at once. For example, you can’t use XPath to grab JSON bits, nor can you treat the entire response as a JavaScript object. By mixing two formats you get a “worst of both worlds” problem when it comes to manipulating the data.