I am new to JSON and I want to store multi records in JSON format and then be able to loop through the records.
Here is what I am trying to do:
<?php
$json = '{"first_name":"Todd","last_name":"Cary","nick_name":"Todd"}';
$json2 = '{"first_name":"Todd","last_name":"Cary","nick_name":"Todd"},
{"first_name":"David","last_name":"Smith","nick_name":"Dave"}';
$obj = json_decode($json);
print_r($obj->{'nick_name'});
?>
I do not know how to do the same with $json2 e.g. loop through each record and display "nick_name".
Any help to point me in the right direction would be appreciated.
Todd