0
我是JOLT的新手,我需要將我的JSON文件轉換爲所需的模式。這是我的輸入轉換JSON-JSON JOLT
[
{
"PK": 12345,
"FULL_NAME":"Amit Prakash",
"BIRTHDATE":"1987-05-25",
"SEX":"M",
"EMAIL": "[email protected]",
"PHONE": "809386731",
"TS":"2015-11-19 14:36:34.0"
},
{
"PK": 12654,
"FULL_NAME": "Rohit Dhand",
"BIRTHDATE":"1979-02-01",
"SEX":"M",
"EMAIL": "[email protected]",
"PHONE": "937013861",
"TS":"2015-11-20 11:03:02.6"
},
...
]
,這是我想要的輸出:
{
"records": [
{
"attribs": [{
"type": "customer",
"reference": "CUST"
}],
"name": "Amit Prakash",
"personal_email": "[email protected]",
"mobile": "809386731",
"id": 12345
},
{
"attribs": [{
"type": "customer",
"reference": "CUST"
}],
"name": "Rohit Dhand",
"personal_email": "[email protected]",
"mobile": "937013861",
"id": 12654
},
...
]
}
到目前爲止,我只設法到這一點:
[
{
"operation": "remove",
"spec": {
"*": {
"BIRTHDATE": "",
"SEX": "",
"TS": ""
}
}
},
{
"operation": "shift",
"spec": {
"*": "records"
}
}
]
但我不能去從這裏開始。我不知道如何重命名輸出中的鍵。
另外,有什麼可以替代刪除操作? 刪除如果您排除的鍵數少於包含的鍵,那麼操作是很好的,但反過來如何(包含幾個鍵,多於在JSON對象內排除)?