0

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.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.