bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.56k stars 329 forks source link

Array transformation and grouping #1047

Open ankitsoni13 opened 3 years ago

ankitsoni13 commented 3 years ago

Hi I have below problem set. I am not able to generate corresponding jolt spec. If you can help me. Thanks!! ---INPUT--- [ { "productId":"1", "productName":"ELECTRONICS", "subProductId":"_1" "subProductName":"MOBILE" }, { "productId":"1", "productName":"ELECTRONICS", "subProductId":"_3", "subProductName":"TV" }, { "productId":"2", "productName":"ELECTRICAL", "subProductId":"_2", "subProductName":"FAN" } ]

---DESIRED OUTPUT --- [ { "productId":"1", "productName":"ELECTRONICS", "subProducts":[ { "subProductId":"_1", "subProductName":"MOBILE" }, { "subProductId":"_3", "subProductName":"TV" }

    ]
},
{
    "productId":"2",
    "productName":"ELECTRICAL",
    "subProducts":[
        {
            "subProductId":"_2",
            "subProductName":"FAN"
        }
    ]
}   

]