输入内容:
[
{
"MAIN": {
"SCALE": "N",
"TAX": "INV",
"DETAIL_GROUP": [
{
"ORDER_GROUP": "LD6",
"CENTRAL_TP": [
{
"LEG_DETAILS": [
{
"DETAIL_LINE": [
{
"ORDER_LINE": "L6",
"DETAILS": [
{
"AMOUNT": 1,
"QTY": 1,
"REGION": "EMEA"
}
]
},
{
"DETAILS": [
{
"AMOUNT": 2,
"QTY": 2,
"REGION": "EMEA"
}
]
}
]
},
{
"DETAIL_LINE": [
{
"DETAILS": [
{
"AMOUNT": 3,
"QTY": 3,
"REGION": "EMEA"
}
]
},
{
"DETAILS": [
{
"AMOUNT": 4,
"QTY": 4,
"REGION": "EMEA"
}
]
}
]
},
{
"DETAIL_LINE": [
{
"DETAILS": [
{
"AMOUNT": 5,
"QTY": 5,
"REGION": "EMEA"
}
]
}
]
},
{
"DETAIL_LINE": [
{
"DETAILS": [
{
"AMOUNT": 6,
"QTY": 6,
"REGION": "EMEA"
}
]
}
]
}
]
}
]
}
]
}
}
]
规格:
[
{
"operation": "shift",
"spec": {
"*": {
"@MAIN": {
"@DETAIL_GROUP": {
"*": {
"@ORDER_GROUP": "detail[&2].orderGrouop",
"@CENTRAL_TP": {
"*": {
"@LEG_DETAILS": {
"*": {
"@DETAIL_LINE": {
"*": {
"@ORDER_LINE": "detail[&2].orderLine",
"@DETAILS": {
"*": {
"@AMOUNT": "detail[&2].itemInfo.adjustment",
"@QTY": "detail[&2].itemInfo.quantity",
"REGION": {
"#region": "detail[&4].itemInfo.additionalInfo[0].property",
"@": "detail[&4].itemInfo.additionalInfo[0].value"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
]
输出:
{
"detail": [
{
"orderGrouop": "LD6",
"orderLine": "L6",
"itemInfo": {
"adjustment": [
1,
3,
5,
6
],
"quantity": [
1,
3,
5,
6
],
"additionalInfo": [
{
"property": [
"region",
"region",
"region",
"region"
],
"value": [
"EMEA",
"EMEA",
"EMEA",
"EMEA"
]
}
]
}
},
{
"itemInfo": {
"adjustment": [
2,
4
],
"quantity": [
2,
4
],
"additionalInfo": [
{
"property": [
"region",
"region"
],
"value": [
"EMEA",
"EMEA"
]
}
]
}
}
]
}
预期:
{
"detail": [
{
"orderGrouop": "LD6",
"orderLine": "L6",
"itemInfo": {
"adjustment": 1,
"quantity": 1,
"additionalInfo": [
{
"property": "region",
"value": "EMEA"
}
]
}
},
{
"orderGrouop": "LD6",
"orderLine": "L6",
"itemInfo": {
"adjustment": 2,
"quantity": 2,
"additionalInfo": [
{
"property": "region",
"value": "EMEA"
}
]
}
},
{
"orderGrouop": "LD6",
"orderLine": "L6",
"itemInfo": {
"adjustment": 3,
"quantity": 3,
"additionalInfo": [
{
"property": "region",
"value": "EMEA"
}
]
}
},
{
"itemInfo": {
"adjustment": 4,
"quantity": 4,
"additionalInfo": [
{
"property": "region",
"value": "EMEA"
}
]
}
},
{
"itemInfo": {
"adjustment": 5,
"quantity": 5,
"additionalInfo": [
{
"property": "region",
"value": "EMEA"
}
]
}
},
{
"itemInfo": {
"adjustment": 6,
"quantity": 6,
"additionalInfo": [
{
"property": "region",
"value": "EMEA"
}
]
}
}
]
}
1条答案
按热度按时间fcipmucu1#
它将添加更多的标识符节点(在本例中,我使用了**&5_&3和&6_&4来表示相对元素的深度)。顺便说一句,除非是路径定义,否则不需要在键前面加上@**前缀。因此,您可以使用以下转换: