1. Go to this page and download the library: Download codekandis/json-codec 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/ */
codekandis / json-codec example snippets
$value = [
'foo',
'bar'
];
( new JsonEncoder() )
->encode( $value );
$options = new JsonEncoderOptions( JsonEncoderOptions::FORCE_OBJECT | JsonEncoderOptions::PRETTY_PRINT );
( new JsonEncoder() )
->encode( $value, $options );
$value = '{"0":"foo","1":"bar"}';
( new JsonDecoder() )
->decode( $value );
$options = new JsonDecoderOptions( JsonDecoderOptions::OBJECT_AS_ARRAY );
( new JsonDecoder() )
->decode( $value, $options );
$options = new JsonDecoderOptions( JsonDecoderOptions::OBJECT_AS_ARRAY );
$recursionDepth = 2;
( new JsonDecoder() )
->decode( $value, $options, $recursionDepth );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.