Invalid character while converting from JSON to XML using jsonlib
问题 I'm trying to convert a JSON string to XML using jsonlib in Java. JSONObject json = JSONObject.fromObject(jsonString); XMLSerializer serializer = new XMLSerializer(); String xml = serializer.write( json ); System.out.println(xml); The error that I get is nu.xom.IllegalNameException: 0x24 is not a legal NCName character The problem here is that I have some properties in my JSON that are invalid XML characters. eg. I have a property named "$t". The XMLSerializer throws the exception while