Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 06-14-2020 06:23 AM
@dg
Your desired output contains DG as value for userLabel. I am not sure if it is a typo, so, I tried converting it as well. If not needed, you can remove the modify-overwrite-beta part.
[
{
"operation": "modify-overwrite-beta",
"spec": {
"userLabel": "DG"
}
},
{
"operation": "shift",
"spec": {
"Types": {
"*": {
"subTypes": {
"*": {
"*": {
"$0": "Types[&4].subType[&2].Name",
"*": {
"$": "Types[&5].subType[&3].CounterNames[]",
"@": "Types[&5].subType[&3].CounterValues[]"
}
}
}
},
"*": "Types[&1].&"
}
},
"*": "&"
}
},
{
"operation": "shift",
"spec": {
"Types": {
"*": {
"subType": {
"*": {
"CounterNames": {
"*": "Types[&4].subType[&2].Counters[&].name"
},
"CounterValues": {
"*": "Types[&4].subType[&2].Counters[&].value"
},
"*": "Types[&3].subType[&1].&"
}
},
"*": "Types[&1].&"
}
},
"*": "&"
}
}
]
Here, the second spec(first shift) gives the following:
{
"vendor" : "myINC",
"beginTime" : "2020-01-21T10:00:00+08:00",
"userLabel" : "DG",
"Types" : [ {
"Name" : "type001",
"subType" : [ {
"Name" : "subtype003",
"CounterNames" : [ "counter1", "counter5", "counter54" ],
"CounterValues" : [ "0", "0", "0" ]
}, {
"Name" : "subtype001",
"CounterNames" : [ "counter002", "counter5", "counter65" ],
"CounterValues" : [ "0", "0", "0" ]
} ]
}, {
"Name" : "type002",
"subType" : [ {
"Name" : "subtype006",
"CounterNames" : [ "counter1", "counter5", "counter54" ],
"CounterValues" : [ "0", "0", "0" ]
}, {
"Name" : "subtype009",
"CounterNames" : [ "counter002", "counter5", "counter65" ],
"CounterValues" : [ "0", "0", "0" ]
} ]
} ]
}The last spec gives you the desired output