When we are using, it happened that keyNames in out JSON contained $ character. When this JSON was converted to XML, it puts those characters unmodified as xml node name, which makes xml invalid. Please remove invalid characters from xml node names when converting from JSON to xml.