Hi
we are using opdk 4.50 .
We are having issues with json to xml policy.
below is a sample json payload(which is url encoded)
{
"id":"abcd1234"
}
The payload is tranformed to xml using json to xml policy
After parsing using json to xml, the output is becoming below:
<id>&#x61;&#x62;&#x63;&#x64;&#x31;&#x32;&#x33;&#x34;<id>
Any idea how to fix this?
Regards
Solved! Go to Solution.
That transformation is not broken. Nothing to fix!
The ampersands need to be encoded that way in XML.
The backend system will receive an ampersand, if it handles XML properly.
If you are asking if you can persuade the JSON-to-XML transformation in Apigee to NOT encode the ampersands, the answer is NO, you cannot persuade Apigee to produce not-well-formed XML, at least not with the JSON-to-XML policy.
& cannot be used directly in XML
Please refer to https://www.w3.org/TR/REC-xml/
I understand the point .
However our backend target system accepts "&" in the payload 🙂
Is there a way to fix this transformation in apigee?
That transformation is not broken. Nothing to fix!
The ampersands need to be encoded that way in XML.
The backend system will receive an ampersand, if it handles XML properly.
If you are asking if you can persuade the JSON-to-XML transformation in Apigee to NOT encode the ampersands, the answer is NO, you cannot persuade Apigee to produce not-well-formed XML, at least not with the JSON-to-XML policy.