@derick100 decode each array element?
@foreach(Session::get('offices') as $office)
{{ json_decode($office)->name }}
@endforeach
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I pushed an array into my session, such that I now have something like:
Session['offices'][0]['name'] = Barcelona
Session['offices'][1]['name'] = Paris
Session['offices'][2]['name'] = London
And tried to retrieve the 'name' value in my blade template like so:
@foreach(Session::get('offices') as $office)
{{ $office }}
@endforeach
However, the values are displayed, json-formatted:
[{"name":"Barcelona"}],{"name":"Paris"},{"name":"London"}]
Since it's coming from Session, how can I json_decode this data to display as simply:
Barcelona, Paris, London ?
Please or to participate in this conversation.