Why is the JSON content property treated special when converted to XML? Why is the JSON content property treated special when converted to XML? json json

Why is the JSON content property treated special when converted to XML?


This seems to be a non-optimal implementation decision. The most recent discussion have taken place in org.json issue #394:

"content" is an unfortunately-named keyword in the XML <-> Java transformation. For the history of this issue, please see #344, #286, and #108. For more information about how the keyword works, see XMLTest.java contentOperations() in https://github.com/stleary/JSON-Java-unit-test.

No objection if someone wants to propose a workaround along the lines of #108, or any other approach that does not break existing applications.


There is underscore-java library with static method U.jsonToXml(json). It supports content key name. I am the maintainer of the project.

{    "content": "X"}    

Output:

<?xml version="1.0" encoding="UTF-8"?><content>X</content>