1. Go to this page and download the library: Download eftec/services_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/ */
eftec / services_json example snippets
use eftec\ServicesJson\Services_JSON;
use eftec\ServicesJson\Services_JSON;
$json='{"hello":{"a":2,"b":3},"world":[1,2,3,"aaa"]}';
var_dump(Services_JSON::decode($json)); // as stdclass
var_dump(Services_JSON::decode($json,Services_JSON::GET_ARRAY)); // as array
$json='{hello:{a:2,b:3},world:[1,2,3,"aaa","bbbb"]}'; // the keys are unquoted.
var_dump(Services_JSON::decode($json)); // as stdclass
var_dump(Services_JSON::decode($json,Services_JSON::GET_ARRAY)); // as array