我想使用mule Dataweave转换进行以下转换。输入是JSON键值对的数组。我需要拆分相同的。
输入
{
"order":[
{
"key":"Status",
"value":"Completed"
},
{
"key":"Source",
"value":"internet"
},
{
"key":"name",
"value":"abc def"
},
{
"key":"domain",
"value":"insurance"
}
]
}
输出
{
"order":[
{
"key":"Status",
"value":"Completed"
},
{
"key":"Source",
"value":"internet"
}
],
"Name":[
{
"key":"name",
"value":"abc def"
},
{
"key":"domain",
"value":"insurance"
}
]
}
有人可以帮忙吗?
答案 0 :(得分:0)
您可以通过根据键
过滤输入来实现import groovy.time.TimeCategory
import java.text.SimpleDateFormat
def testCase = messageExchange.modelItem.testCase;
def startdatetime = testCase.testSuite.project.getPropertyValue("StartDateTime").toString();
log.info startdatetime
aaa = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(startdatetime)
use(TimeCategory)
{
def enddatetime = aaa + 5.minutes
log.info enddatetime
}
希望这有帮助。