我是nifi(1.14)的新手,使用JOLTTransform处理器将输入的json(flatten)转换为嵌套的json。我无法用JOLT Schema修复。请帮助我。
输入的JSON是:
[
{
"executionTime": "2244",
"processorId": "3ef03f9c-b42c-4c4e-9d5f-d14878bb2c84",
"filename": "Trading",
"processStartTime": "2021-07-26 16:31:19",
"processSQL": "TradingDetails.sql",
"executionFetchTime": "2049",
"sourceCountValue": "5076",
"startTime": "1627297279651",
"processGroupName": "Trading"
},
{
"ProcessEndTime": "2021-07-26 16:31:29",
"completedTime": "1627297289412",
"processDuration": "0",
"destCountValue": "5076",
"tableName": "TRADINGDETAILS"
},
{
"ProcessEndTime": "2021-07-26 16:31:29",
"completedTime": "1627297289412",
"processDuration": "0",
"destCountValue": "5076",
"tableName": "CUSTTRADINGDETAILS"
}
]
预期的JSON输出为
{
"Trading": {
"Source": {
"executionTime": "2244",
"processorId": "3ef03f9c-b42c-4c4e-9d5f-d14878bb2c84",
"filename": "Trading",
"processStartTime": "2021-07-26 16:31:19",
"processSQL": "TradingDetails.sql",
"executionFetchTime": "2049",
"sourceCountValue": "5076",
"startTime": "1627297279651",
"processGroupName": "Trading"
},
"Destination": {
"TRADINGDETAILS": {
"ProcessEndTime": "2021-07-26 16:31:29",
"completedTime": "1627297289412",
"processDuration": "10",
"destCountValue": "5076",
"tableName": "TRADINGDETAILS"
},
"CUSTTRADINGDETAILS": {
"ProcessEndTime": "2021-07-26 16:31:29",
"completedTime": "1627297289412",
"processDuration": "10",
"destCountValue": "5076",
"tableName": "CUSTTRADINGDETAILS"
}
}
}
}
先谢了。
1条答案
按热度按时间4sup72z81#
可以使用连续的shift转换;枚举第一个对象中对象的键,然后重命名它们,同时将每个对象嵌套在相关键下,如