我特灵准备一个jolt
规范的预期输出,请帮助我。
注意:
预期输出:如果credit在具有多个字段的数组中,则json将被拆分为subjson,其中InvoiceMonth
将仅与input相同,但在第一个subjson中,InvoiceMonth
值具有剩余的subjson InvoiceMonth
值需要为0。
输入:
[
{
"InvoiceMonth": "202306",
"credit": {
"name": [
"7828credit:0",
"2738credit:0"
],
"amount": [
"2.5E-5",
"5.0E-5"
],
"full_name": [
"Committed USAGE",
"Committed USAGE "
],
"id": [
"7822credit:0",
"2732credit:0"
],
"type": [
"COMMITTEDDISCOUNT",
"COMMITTEDDISCOUNTBASE"
]
},
"resource_name": "projects-2",
"resource_global_name": "//https.googleapis.com/",
"label": ""
}
]
输出:
[
{
"InvoiceMonth": "202306",
"credit": {
"name": "7822credit:0",
"amount": "2.5E-5",
"full_name": "Committed",
"id": "7822credit:0",
"type": "COMMITTEDUSAGE"
},
"resource_name": "projects-2",
"resource_global_name": "//https.googleapis.com/",
"label": ""
},
{
"InvoiceMonth": "0",
"credit": {
"name": "2738credit:0",
"amount": "5.0E-5",
"full_name": "Committed ",
"id": "2738_credit:0",
"type": "COMMITTEDUSAGEDISCOUNT"
},
"resource_name": "projects-2",
"resource_global_name": "//https.googleapis.com/",
"label": ""
}
]
1条答案
按热度按时间ndh0cuux1#
您可以使用以下规范
其中的主要思想是循环遍历
"credit"
对象下的数组,然后添加其他属性。