json2xml
json2xml copied to clipboard
Preserve certain text from being escaped
Is your feature request related to a problem? Please describe.
In a project, I need to preserve ampersands inside text so that I can have the following nodes:
<class> &InventoryMenu; </class>
<alpha> 0 </alpha>
<locus> &true; </locus>
However, inserting an ampersand as normal results in it being escaped to &
. I couldn't tell if there were some mechanism in the library for preventing that behavior already, but it would be useful to have one.
Describe the solution you'd like
A backwards-slash-based solution seems the most straightforward, like:
{
"class": "\\&InventoryMenu;",
"alpha": 0,
"locus": "\\&true;"
}
Describe alternatives you've considered
Some macro-based solutions came to mind, but none that seemed reasonable.
Thanks for reporting this. I will need to think about a way to implement it in a backward compatible way. Let me get back to you on this.
@ernieIzde8ski I just looked into this. It looks like escaping is the correct thing to do in this case and there is no good way to implement this without breaking backward compatibility.