Hello guys,
I’m using Play Json to work with json data.
with Akka Stream I have this input:
{
"sku": 0,
"buffer": 0,
"consistency": 0,
"inner": 0,
"stores": [
{
"store": 1,
"eoh": 0,
"store_last_received": "yyyy-MM-dd",
"store_sales_qtd_last_six_weeks": 0,
"store_size": "G",
"store_lead_time": 0,
"vm": 0
},
{
"store": 2,
"eoh": 0,
"store_last_received": "yyyy-MM-dd",
"store_sales_qtd_last_six_weeks": 0,
"store_size": "G",
"store_lead_time": 0,
"vm": 0
}
]
}
I need to make this output, one event per “stores” array, with this example, enter 1 event and out 2 events, with this schema:
//// EVENT 1
{
"sku": 0,
"buffer": 0,
"consistency": 0,
"inner": 0,
"store": 2,
"eoh": 0,
"store_last_received": "yyyy-MM-dd",
"store_sales_qtd_last_six_weeks": 0,
"store_size": "G",
"store_lead_time": 0,
"vm": 0,
"forecast": 0,
"vm_fulfilled": false,
"consistency_fulfilled": false,
"final_buffer": 0
}
//// EVENT 2
{
"sku": 0,
"buffer": 0,
"consistency": 0,
"inner": 0,
"store": 1,
"eoh": 0,
"store_last_received": "yyyy-MM-dd",
"store_sales_qtd_last_six_weeks": 0,
"store_size": "G",
"store_lead_time": 0,
"vm": 0,
"forecast": 0,
"vm_fulfilled": false,
"consistency_fulfilled": false,
"final_buffer": 0
}