PHP code example of rcs_us / php-json

1. Go to this page and download the library: Download rcs_us/php-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/ */

    

rcs_us / php-json example snippets


// Decode JSON
$decoded_json = json_encode($json_to_encode);

// Act on decoded JSON
if ( $decoded_json->some_property == "some_value" ) {

}

string \RCS\Json::Encode ( mixed $value [, int $options = 0 [, int $depth = 512 ]] )
mixed \RCS\Json::Decode ( string $json [, bool $assoc = FALSE [, int $depth = 512 [, int $options = 0 ]]] )

try {
    $encoded_json = \RCS\Json::Encode($json_to_encode);
} catch ( \RCS\JsonException $e ) {
    // ... Do what you want with the exception
}

try {
    $decoded_json = \RCS\Json::Decode($json_to_decode);
} catch ( \RCS\JsonException $e ) {
    // ... Do what you want with the exception
}


$ composer