1. Go to this page and download the library: Download byjg/anydataset-json library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
byjg / anydataset-json example snippets
$json = file_get_contents('example1.json');
$dataset = new \ByJG\AnyDataset\Json\JsonDataset($json);
$iterator = $dataset->getIterator();
foreach ($iterator as $row) {
echo $row->get('name'); // Print Joao, John, Jane
echo $row->get('surname'); // Print Magalhaes, Doe, Smith
echo $row->get('age'); // Print 38, 20, 18
}