User noticed a different behaviour of the Apply JSON Transformation in Gateway Version 9.4 compared with the Gateway Version 9.2.
There is an error with the transformation of special Characters inJSON Payload (example String: TESTdiařťeéß).
The Policy in Version 9.2 looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
<wsp:All wsp:Usage="Required">
<L7p:JsonTransformation>
<L7p:DestinationMessageTarget MessageTarget="included">
<L7p:TargetModifiedByGateway booleanValue="true"/>
</L7p:DestinationMessageTarget>
<L7p:RootTagString stringValue="result"/>
<L7p:Target target="REQUEST"/>
<L7p:Transformation transformation="JSON_to_XML"/>
</L7p:JsonTransformation>
<L7p:HardcodedResponse>
<L7p:Base64ResponseBody stringValue="JHtyZXF1ZXN0Lm1haW5wYXJ0fQ=="/>
</L7p:HardcodedResponse>
</wsp:All>
</wsp:Policy>
The Call is working for Version 9.2 and the Special character will be Pre-transformed like this (which is correct). During transforming it back to JSON the client receives the correct special characters:
POST https://xxx.xx.xx/test/transformation
200
120ms
Client Certificate
Network
Request Headers
Request Body
test1: {…}
definitionName: "TESTdiařťeéß"
Response Headers
Response Body
<result><test1><definitionName>TESTdiaÅÅ¥eéÃ</definitionName></test1></result>
The Policy in Gateway Version 9.4 is exactly the same:
<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
<wsp:All wsp:Usage="Required">
<L7p:JsonTransformation>
<L7p:DestinationMessageTarget MessageTarget="included">
<L7p:TargetModifiedByGateway booleanValue="true"/>
</L7p:DestinationMessageTarget>
<L7p:RootTagString stringValue="result"/>
<L7p:Target target="REQUEST"/>
<L7p:Transformation transformation="JSON_to_XML"/>
</L7p:JsonTransformation>
<L7p:HardcodedResponse>
<L7p:Base64ResponseBody stringValue="JHtyZXF1ZXN0Lm1haW5wYXJ0fQ=="/>
</L7p:HardcodedResponse>
</wsp:All>
</wsp:Policy>
The result of the test shows that the special characters are converted to questions marks. During transforming it back to JSON the client receives questions marks instead of the special characters:
POST https://xxx.xxx.xxx/test/transformation
200
388ms
Network
Request Headers
Request Body
test1: {…}
definitionName: "TESTdiařťeéß"
Response Headers
Response Body
<result><test1><definitionName>TESTdia????e????</definitionName></test1></result>
Release : 9.4
Component : CA API Gateway