json_decode

Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL json >= 1.2.0
Decodes a JSON string
json_decode(    string $json,    ?bool $associative null,    int $depth 512,    int $flags 0): mixed
    'console',

];



$regions json_decode(file_get_contents(__DIR__ '/regions.json'), true);



$export = [];

foreach (
$regions as $region) {
    $regions = [$singleRegion];

} else {

    
$regions json_decode(file_get_contents(__DIR__ '/regions.json'), true);

}
        $region $input->getArgument('region');



        
$layersJson file_get_contents(dirname(__DIR__3) . '/layers.json');

        
$layers json_decode($layersJsontrue512JSON_THROW_ON_ERROR);

        
$io->title("Layers for the $region region");



        
$array = [];
        }



        try {

            
$event $data json_decode($datatrue512JSON_THROW_ON_ERROR) : null;

        } catch (
JsonException $e) {

            throw new 
Exception('The JSON provided for the event data is invalid JSON.');

        }
    public function getData(): array

    {

        return 
json_decode(base64_decode($this->getRawData()), true);

    }



    public function 
getEventName(): string
            'Payload' => $event ?? '',

        ]);



        
$resultPayload json_decode($rawResult->getPayload(), true);

        
$invocationResult = new InvocationResult($rawResult$resultPayload);



        
$error $rawResult->getFunctionError();
            throw new Exception('Failed to determine the Lambda invocation ID');

        }



        
$event json_decode($bodytrue);



        return [
$event$context];

    }
{

    public function 
test_connect()

    {

        
$event json_decode(file_get_contents(__DIR__ '/Samples/websocket-connect.json'), true);

        
$event = new WebsocketEvent($event);



        
$this->assertSame('CONNECT'$event->getEventType());
    public function test_disconnect()

    {

        
$event json_decode(file_get_contents(__DIR__ '/Samples/websocket-disconnect.json'), true);

        
$event = new WebsocketEvent($event);



        
$this->assertSame('DISCONNECT'$event->getEventType());
    public function test_message()

    {

        
$event json_decode(file_get_contents(__DIR__ '/Samples/websocket-message.json'), true);

        
$event = new WebsocketEvent($event);



        
$this->assertSame('MESSAGE'$event->getEventType());
    public function test_canonical_case()

    {


        
$event json_decode(file_get_contents(__DIR__ '/dynamodb.json'), true);

        
$keys = ['Id' => ['N' => '101']];

        
$newImage = [

            
'Message' => ['S' => 'New item!'],
    public function test_old_image()

    {


        
$event json_decode(file_get_contents(__DIR__ '/dynamodb.json'), true);

        
$keys = ['Id' => ['N' => '101']];

        
$newImage = [

            
'Message' => ['S' => 'New item!'],
    public function test_new_and_old_images()

    {


        
$event json_decode(file_get_contents(__DIR__ '/dynamodb.json'), true);

        
$keys = ['Id' => ['N' => '101']];

        
$newImage = [

            
'Message' => ['S' => 'This item has changed'],
    public function test_keys_only()

    {


        
$event json_decode(file_get_contents(__DIR__ '/dynamodb.json'), true);

        
$keys = ['Id' => ['N' => '101']];

        
$eventName 'REMOVE';
{

    public function 
test canonical case()

    {

        
$json json_decode(file_get_contents(__DIR__ '/eventbridge.json'), true);

        
$event = new EventBridgeEvent($json);



        
$this->assertSame('53dc4d37-cffa-4f76-80c9-8b7d4a4d2eaa'$event->getId());