PHP code example of digiaonline / json-helpers
1. Go to this page and download the library: Download digiaonline/json-helpers 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/ */
digiaonline / json-helpers example snippets
$data = [
'foo' => 'bar'
];
try {
$json = \Digia\JsonHelpers\JsonEncoder::encode($data);
}
catch (\InvalidArgumentException $e) {
}
$json = '["foo":"bar"]';
try {
$data = \Digia\JsonHelpers\JsonDecoder::decode($data);
}
catch (\InvalidArgumentException $e) {
}