I have a json object days:
days = {"available_hours":{
"Monday" : [ ["5:30 am","11:00 am"] , [“1:00 pm","4:00 pm”], ["4:00 pm”, "9:00 pm"] ]
"Tuesday" : [ [“2:30 pm","7:50 pm"] ]
"Friday" : [ [“7:30 am","12:50 pm"], [“4:00 pm","11:59 pm”] ]
}
and I want to get a list with each day and the available hours as a string.
["Monday 5:30 am - 11:00 am, 1:00 pm - 4:00 pm, 4:00 pm - 9:00 pm”, "Tuesday 2:30 pm","7:50 pm",etc ]
I am using this function to precess the data and I am passing each day JSON object:
private func hoursList(shifts: [[String]]) -> String{
var shiftslist: [String] = []
var shifttext: String = ""
for shift in shifts {
shifttext += "\(shifts[0]) - \(shift[1])"
shiftslist.append(shifttext)
}
return join(", ", shiftslist)
}
the problem is that I cant pass any day because its not convertible to [[String]]