Hi there,
I am trying to combine / move objects from a storage based on (a part of) the product number.
For example, this is my data:
{
"products": {
"1234_A01_P01": {
"data": "productdata"
},
"1234_A02_P02": {
"data": "productdata"
},
"1235_A02_TX": {
"data": "productdata"
},
"1352_A06_PP": {
"data": "productdata"
},
"1352_A01_PP": {
"data": "productdata"
}
}
}
I want to create objects based on the part before the first β_β and combine / move the existing objects into a nested one. The output should be this:
{
"1234": {
"1234_A01_P01": {
"data": "productdata"
},
"1234_A02_P02": {
"data": "productdata"
}
},
"1235": {
"1235_A02_TX": {
"data": "productdata"
}
},
"1352": {
"1352_A06_PP": {
"data": "productdata"
},
"1352_A01_PP": {
"data": "productdata"
}
}
}
This way, all the objects that correspond to the first values before the β_β are inside the same object.