To convert a JSON structure to XML, all slashes in the keys (and sub keys) must be removed because slashes are not allowed in tag names.
"langServices": {"en/ENGLISH_ONLY": "English"}
One possible solution is replacing slashes with dashes like this:
var finalData = jsonstr.replace(/\//g, "-");
This approach will effectively handle cases such as {"can/cancel" : "true"}
, where the string before the slash is variable and unknown.