so this is the portion of my code :
var roomid= roomIds[i]
const Availabilitydata = await AvailResponse.json();
availableroomsArray.push(Availabilitydata);
app.get("/api/availability", (req, res) => {
res.json({ indicateur: availableroomsArray});});
}
so the variable indicateur looping 3 rooms Ids in an array
so when you visit /api/availability it will print the availibility of the 3 rooms in 2022-03-20 this way
{"indicateur":[{"20220320":{"i":1,"p1":"74.00","p2":"78.00","p3":"70.3000","p4":"122.4600"},"20220320"{"i":0,"p1":"74.00","p2":"77.00","p3":"70.3000","p4":"120.8900"},"20220320":{"i":0,"p1":"65.00","p2":"68.00","p3":"61.7500","p4":"106.7600"}}]}
and it is working fine .
What i am trying to achieve is displaying the roomId of each room in front of its availability like this :
{"1212":[{"20220320":{"i":1,"p1":"74.00","p2":"78.00","p3":"70.3000","p4":"122.4600"}]},
{"1213":[{"20220320"{"i":0,"p1":"74.00","p2":"77.00","p3":"70.3000","p4":"120.8900"}]},
{"1214":[{""20220320":{"i":0,"p1":"65.00","p2":"68.00","p3":"61.7500","p4":"106.7600"}}]}
I tried to replace indicateur
in res.json({ indicateur: availableroomsArray});});
by roomid
but it will be printed as it is