我有以下流程:骡子ESB:转换JSON对象到另一个对象
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<db:generic-config name="Generic_Database_Configuration" url="jdbc:db2://localhost:50000/TEST:user=instuid;password=instpw;" driverClassName="com.ibm.db2.jcc.DB2Driver" doc:name="Generic Database Configuration"/>
<flow name="test2Flow1" doc:name="test2Flow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<db:select config-ref="Generic_Database_Configuration" doc:name="Database" doc:description="test">
<db:parameterized-query><![CDATA[SELECT SUM(BAL) FROM xxxx.ACCT]]></db:parameterized-query>
</db:select>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule>
流动的话很好,因为你可以看到JSON对象转换数据库对象为以下内容: (A JSON与一个单一的对象):
[{"1":444}]
请注意,444是一个数值(它没有引号周围)。
我想做
没有阵列创建一个简单的JSON结构从数值
更改444为一个字符串值什么
让它看起来像:(将444放入另一个结构中)
{“Total”:“444”,“Date”:“14/07/14”}
我知道,要得到系统日期,我执行以下操作:
#[server.dateTime.format('dd/MM/yy')]
...我知道从原始字符串值444,我执行以下操作:
$..1
但我不知道下一步该怎么做。
现在我使用JSON对象来查看数据库连接器的结果,下一步我要做什么对象来创建我的新结构。
我是否使用另一个JSON对象,如何构造表达式?