Closed ulhep closed 3 years ago
I made it working using following spec:
[ { "operation": "shift", "spec": { "": { "externalProductCode": "[&1].key", "businessDomains": { "": { "Option|Equipment|Mobile|Data": { "$0": "[&4].categories[]" } } } } } } ]
I am trying to transform following input json into a new json form:
Input json: [{ "externalProductCode": "FLOB0007", "businessDomains": [ "Option", "Allow Split" ] }, { "externalProductCode": "SOTF0011", "businessDomains": [ "Mobile", "Data", "Test Only" ] }, { "externalProductCode": "EQUI0160", "businessDomains": [ "Equipment", "Non Prod" ] } ]
Expected output: [ { "key" : "FLOB0007", "categories" : [ "Option" ] }, { "key" : "SOTF0011", "categories" : ["Mobile", "Data"] }, { "key" : "EQUI0160" "categories" : [ "Equipment" ] } ]
But, I could achieve: [ { "key" : "FLOB0007", "categories" : [ "Option", "Mobile", "Equipment" ] }, { "key" : "SOTF0011", "categories" : "Data" }, { "key" : "EQUI0160" } ]
My spec: [ { "operation": "shift", "spec": { "": { "externalProductCode": "[&1].key", "businessDomains": { "": { "Option|Equipment|Mobile|Data": { "$0": "[&2].categories" } } } } } } ]
Where am I going wrong? Please guide me.