我有这样的回复:
Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><jsonObject><Number>UUI006</Number><Number>UURR007</Number><Number>UUR004</Number></jsonObject></soapenv:Body></soapenv:Envelope>
我的JSON格式的架构和输出如下所示。
方法1
架构:
<property expression="$body/*" name="test" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<jsonObject>
<code>$1</code>
</jsonObject>
</format>
<args>
<arg evaluator="xml" expression="$ctx:test"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
输出:
{
"code": {
"number": [
"UUI006",
"UURR007",
"UUR004"
]
}
}
方法2
架构:
<property expression="json-eval($.number)" name="test" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<jsonObject>
<code>$1</code>
</jsonObject>
</format>
<args>
<arg evaluator="xml" expression="$ctx:test"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
输出:
{
"code": "[\"UUI006\",\"UURR007\",\"UUR004\"]"
}
但我需要这样的JSON格式,我该怎么办?
{
"code": [ "UUI006", "UURR007", "UUR004" ]
}