1. Go to this page and download the library: Download gemul/jsonparser 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/ */
gemul / jsonparser example snippets
$json = new \Gemul\JsonParser($json_string);
$json = new \Gemul\JsonParser(storage_path('/app/public/dummy.json'));
$json->getItem('info.contact.phone'); // null (path not found in tree, default to null)
$json->getItem('info.contact.phone',1234); // 1234 (set the default to 1234 instead of null)
$json->getItem('info.foo.bar',false); // false (doesn't throw 'Undefined property "foo"' exception)
$json->setItem('info.version','1.0.0');
$json->setItem('info.foo.bar.baz','somevalue');
$json->setItem('servers.2.url', "new url");
//or
$json->setItem('servers.[].url', "new url");
$json->getItem('info.contact.phone.home');
//will return "info.contact", because from 'phone' onward doesn't exist