json_encode

Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL json >= 1.2.0
Returns the JSON representation of a value
<?php json_encode(mixed $value, int $flags = 0, int $depth = 512): string|false
<?php             return null;

        }



        $encoded = json_encode($value);



        if (json_last_error() !== JSON_ERROR_NONE) {

            throw ConversionException::conversionFailedSerialization($value, 'json', json_last_error_msg());
<?php             ];

            $this->connection->insert('fetch_table', [

                'test_int'      => $i,

                'test_string'   => json_encode($bitmap[$i]),

                'test_datetime' => '2010-01-01 10:10:10',

            ]);

        }
<?php     public function testJsonStringConvertsToPHPValue(): void

    {

        $value         = ['foo' => 'bar', 'bar' => 'foo'];

        $databaseValue = json_encode($value);

        $phpValue      = $this->type->convertToPHPValue($databaseValue, $this->platform);



        self::assertEquals($value, $phpValue);
<?php     public function testJsonResourceConvertsToPHPValue(): void

    {

        $value         = ['foo' => 'bar', 'bar' => 'foo'];

        $databaseValue = fopen('data://text/plain;base64,' . base64_encode(json_encode($value)), 'r');

        $phpValue      = $this->type->convertToPHPValue($databaseValue, $this->platform);



        self::assertSame($value, $phpValue);