Closed arunsai271 closed 3 years ago
Input:
{ "chain": [ { "formation": [ { "itemID": "1111", "isConsiderable": false }, { "itemID": "2222", "isConsiderable": false } ] }, { "formation": [ { "itemID": "3333", "isConsiderable": false }, { "itemID": "4444", "isConsiderable": false } ] } ] }
jolt spec:
[ { "operation": "shift", "spec": { "chain": { "": { "formation": { "": { "itemID": "productsList[].products[]" } } } } } } ]
Current output:
{ "productsList" : [ { "products" : [ "1111" ] }, { "products" : [ "2222" ] }, { "products" : [ "3333" ] }, { "products" : [ "4444" ] } ] }
Expected output:
{ "productsList" : [ { "products" : [ "1111","2222" ] }, { "products" : [ "3333" ,"4444"] } ] }
Please help me in achieving this output. I tried so many ways but no luck!
Found the solution and pasted below. Issue resolved and hence closing the issue.
[ { "operation": "shift", "spec": { "chain": { "": { "formation": { "": { "itemID": "productsList[&3].products[&1]" } } } } } } ]
Input:
{ "chain": [ { "formation": [ { "itemID": "1111", "isConsiderable": false }, { "itemID": "2222", "isConsiderable": false } ] }, { "formation": [ { "itemID": "3333", "isConsiderable": false }, { "itemID": "4444", "isConsiderable": false } ] } ] }
jolt spec:
[ { "operation": "shift", "spec": { "chain": { "": { "formation": { "": { "itemID": "productsList[].products[]" } } } } } } ]
Current output:
{ "productsList" : [ { "products" : [ "1111" ] }, { "products" : [ "2222" ] }, { "products" : [ "3333" ] }, { "products" : [ "4444" ] } ] }
Expected output:
{ "productsList" : [ { "products" : [ "1111","2222" ] }, { "products" : [ "3333" ,"4444"] } ] }
Please help me in achieving this output. I tried so many ways but no luck!