[英]WSO 2 EI Response change the first letter to uppercase
Hi in wso2 ei in payload factory i am getting the response in json 您好在有效负载工厂中的wso2 ei中,我正在json中获得响应
<payloadFactory media-type="json">
<format>{
"Body":$1
}
</format>
<args>
<arg evaluator="json" expression="$."/>
</args>
And the Response is : 响应是:
{
"Body":{
"result":"done",
"idNumber":"123",
"address":{
"local":"US",
"abroad":"UK"
}
}
}
.... means multiple objects now what i need that all object first letter should be uppercase. ....表示多个对象,现在我需要所有对象的首字母应为大写。
I need the below response 我需要以下回应
{
"Body":{
"Result":"done",
"IdNumber":"123",
"Address":{
"local":"US",
"abroad":"UK"
}
}
}
Means only the object first letter should be capitalize...Any help! 意味着只有对象首字母应该大写...任何帮助!
Replace payload mediator with xslt mediator . 将有效负载介体替换为xslt介体。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:strip-space elements="*"/>
<xsl:output method="text" indent="yes" media-type="application/json" encoding="UTF-8"/>
<xsl:template match="/">
{
Body :{
<xsl:for-each select="//*[local-name()='pid']">
Result:<xsl:value-of select="result"/>
IdNumber:<xsl:value-of select="idNumber"/>
</xsl:for-each>
}
}
</xsl:template>
</xsl:stylesheet>
Once this is done then you need to use property mediator so that the payload is still in json. 完成此操作后,您需要使用属性中介器,以便有效负载仍位于json中。
<property name="messageType" scope="default" type="STRING" value="application/json"/>
<property name="contentType" scope="default" type="STRING" value="application/json"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.