I have such json
data structure:
$data='[{"day":0,"periods":[{"start":"01:00","end":"02:00","title":"","backgroundColor":"rgba(254, 0, 0, 0.7)","borderColor":"rgb(42, 60, 255)","textColor":"rgb(0, 0, 0)"},{"start":"02:30","end":"03:00","title":"","backgroundColor":"rgba(254, 0, 0, 0.7)","borderColor":"rgb(42, 60, 255)","textColor":"rgb(0, 0, 0)"}]},{"day":1,"periods":[{"start":"01:00","end":"02:00","title":"","backgroundColor":"rgba(254, 0, 0, 0.7)","borderColor":"rgb(42, 60, 255)","textColor":"rgb(0, 0, 0)"}]},{"day":2,"periods":[{"start":"01:00","end":"01:30","title":"","backgroundColor":"rgba(254, 0, 0, 0.7)","borderColor":"rgb(42, 60, 255)","textColor":"rgb(0, 0, 0)"}]},{"day":3,"periods":[{"start":"02:00","end":"02:30","title":"","backgroundColor":"rgba(254, 0, 0, 0.7)","borderColor":"rgb(42, 60, 255)","textColor":"rgb(0, 0, 0)"}]},{"day":4,"periods":[{"start":"01:00","end":"01:30","title":"","backgroundColor":"rgba(254, 0, 0, 0.7)","borderColor":"rgb(42, 60, 255)","textColor":"rgb(0, 0, 0)"}]},{"day":5,"periods":[{"start":"01:30","end":"02:00","title":"","backgroundColor":"rgba(254, 0, 0, 0.7)","borderColor":"rgb(42, 60, 255)","textColor":"rgb(0, 0, 0)"},{"start":"03:00","end":"03:30","title":"","backgroundColor":"rgba(254, 0, 0, 0.7)","borderColor":"rgb(42, 60, 255)","textColor":"rgb(0, 0, 0)"}]},{"day":6,"periods":[]}]';
I want to get all days and start and end time which is in periods.
How to loop threw array and get ? It has 7 days day[0]-day[6] and periods is array which can be empty or have values.
day
periods->start
periods->end