Convert some string value to array format

  Kiến thức lập trình

Can someone please help me to bring test value:

   let test = "a:1|b:2,3|c:4,5"

into below format:

   prod:[
         {
           name:test,
           product:{
                     a:[1],
                     b:[2,3],
                     c:[4,5]
                    }
          }]

1

LEAVE A COMMENT