I am trying to convert a CSV that looks like this:
purchase_order,sku,vendor,qty,boxid
ABC,BARBY,BARBY COMPANY,10,ABC
XYZ,KEN,KEN COMPANY,14,XYZ
WAW,GI JOE,Cobra,WAW
Into a nested JSON structure that looks like this:
{
purchase_order:"ABC",
boxes:[
{
boxid:"ABC",
storeloc:"UK",
items:[
{
sku:"BARBY",
qty:10
},
{
sku:"Skipper",
qty:10
}
]
}
],
vendor:"BARBY COMPANY"
}
I have something that is very similar to this. I'd prefer not to share the exact code because it has sensitive data in it. However, I am not sure how to add another level of nesting. The purchase_order and boxid need to be the same.