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对象内排除)?