Closed loveall closed 3 years ago
Spec:
[
{
"operation": "shift",
"spec": {
"configs": {
"*": {
"code": {
"*": {
"@2": "config.&[]"
}
}
}
},
"codes": "codes"
}
},
{
"operation": "shift",
"spec": {
"config": {
"*": {
"*": {
"configs": {
"*": {
"code": {
"*": {
"@2": "config.&6[&5].config.&[]"
}
}
}
},
"*": "config.&2[&1].&0"
}
}
},
"codes": "codes"
}
},
{
"operation": "shift",
"spec": {
"config": {
"*": {
"*": {
"config": {
"*": {
"*": {
"configs": {
"*": {
"code": {
"*": {
"@2": "config.&9[&8].config.&6[&5].config.&[]"
}
}
}
},
"*": "config.&5[&4].config.&2[&1].&0"
}
}
},
"*": "config.&2[&1].&0"
}
}
},
"codes": "codes"
}
}, {
"operation": "shift",
"spec": {
"config": "config",
"codes": {
"*": {
"YES": {
"$1": "codes[#3].key"
}
}
}
}
}, {
"operation": "shift",
"spec": {
"codes": {
"*": {
"key": {
"*": {
"@(4,config.&0)": {
"*": {
"@5": "configs_filter.&2[&1].codes",
"*": "configs_filter.&2[&1].&0"
}
}
}
}
}
}
}
}, {
"operation": "shift",
"spec": {
"configs_filter": {
"*": {
"*": {
"codes": {
"*": {
"key": {
"*": {
"@(4,config.&0)": {
"*": {
"@5": "configs_filter.&8[&7].configs_filter.&2[&1].codes",
"*": "configs_filter.&8[&7].configs_filter.&2[&1].&0"
}
}
}
}
}
},
"config": null,
"*": "configs_filter.&2[&1].&0"
}
}
}
}
}, {
"operation": "shift",
"spec": {
"configs_filter": {
"*": {
"*": {
"configs_filter": {
"*": {
"*": {
"codes": {
"*": {
"key": {
"*": {
"@(4,config.&0)": {
"*": {
"*": "configs_filter.&11[&10].configs_filter.&8[&7].configs_filter.&2[&1].&0"
}
}
}
}
}
},
"config": null,
"*": "configs_filter.&5[&4].configs_filter.&2[&1].&0"
}
}
},
"*": "configs_filter.&2[&1].&0"
}
}
}
}
}, {
"operation": "shift",
"spec": {
"configs_filter": {
"*": {
"*": "configs[]"
}
}
}
}, {
"operation": "shift",
"spec": {
"configs": {
"*": {
"configs_filter": {
"*": {
"*": "configs[&3].configs[]"
}
},
"*": "configs[&1].&0"
}
}
}
}, {
"operation": "shift",
"spec": {
"configs": {
"*": {
"configs": {
"*": {
"configs_filter": {
"*": {
"*": "configs[&5].configs[&3].configs[]"
}
},
"*": "configs[&3].configs[&1].&0"
}
},
"*": "configs[&1].&0"
}
}
}
}]
output
{
"configs" : [ {
"configs" : [ {
"code" : "ABC"
} ],
"code" : "ABC"
} ]
}
wow , thank you so much for your time and effort lucioalmeida. really apricated your help.
let me study this script , but with first glance seems its good.
Is there any way we can remove elements from an array based on value which is there in different element ? In below example we want to remove array element if code is not listed in "codes" object.
Input to process is as below ,
Expected Output :
Thank you so much for the help in advance.