我需要帮助,我是 Jolt 的新手。有一个json文件:
{
"Date": "2021-01-01",
"Status": "New",
"Agreements": [
{
"ID_agreement": "12345",
"ID": "fffffff",
"balance": {
"rub": 5,
"usd": 6,
"eur": 7
},
"withdrawal": {
"rub": 8,
"usd": 45,
"eur": 6
}
},
{
"ID_agreement": "6789",
"ID": "dddddd",
"balance": {
"rub": 10,
"usd": 20,
"eur": 30
}
}
]
}
在输出中,你真的需要得到这样的东西:
{
"type": "DATA",
"date": "2021-01-01",
"id_agreement": "12345",
"id": "fffffff",
"source": "SITE",
"unloadDateTime": "current date if possible",
"balance": {
"rub": 5,
"usd": 6,
"eur": 7
},
"withdrawal": {
"rub": 8,
"usd": 45,
"eur": 6
}
},
{
"type": "DATA",
"date": "2021-01-01",
"id_agreement": "6789",
"id": "dddddd",
"source": "SITE",
"unloadDateTime": "current date if possible",
"balance": {
"rub": 10,
"usd": 20,
"eur": 30
}
必须添加到每个块:
"type": "DATA",
"date": "2021-01-01",
"source": "SITE",
"unloadDateTime": "current date if possible"
并删除
"Status": "New"
原始文件很大,取款/余额字段在某处,某处不在
我最初的 Jolt 规格:
[
{
"operation": "remove",
"spec": {
"Status": ""
}
},
{
"operation": "shift",
"spec": {
"Agreements": {
"*": "&"
},
"balance": {
"*": "&"
}
}
}
]
用格式化程序拆解数小时没有任何结果,任务是一次性的,请帮助,亲爱的同事!