Converts a JSON string into an object
Converts a JSON string into an object
json_decode
{{$data = "{JSON string}"|json_decode}}
json_decode
{{$data = '{"a":1,"b":2,"c":3,"d":4,"e":5}'|json_decode}}
{{$data->a}}
Output:
1
foreach
{{$data = '{"a":1,"b":2,"c":3,"d":4,"e":5}'|json_decode}}
{{$data|print_r}}
{{foreach $data key=key item=item}}
{{$key}}:{{$item}}
{{/foreach}}
Output:
stdClass Object ( [a] => 1 [b] => 2 [c] => 3 [d] => 4 [e] => 5 )
a:1
b:2
c:3
d:4
e:5