protected function jsonDecode(Field $f, $value, $assoc = true)
    {
        // constant supported only starting PHP 7.3
        if (!defined('JSON_THROW_ON_ERROR')) {
            define('JSON_THROW_ON_ERROR', 0);
        }

        $res = json_decode($value, $assoc, 512, JSON_THROW_ON_ERROR);
        if (JSON_THROW_ON_ERROR == 0 && json_last_error() !== JSON_ERROR_NONE) {
            throw new Exception([
                'There was error while decoding JSON',
                'code'  => json_last_error(),
                'error' => json_last_error_msg(),
            ]);
        }

        return $res;
    }
protected function jsonDecode(Field $f, $value, $assoc = true)
    {
        // constant supported only starting PHP 7.3
        if (!defined('JSON_THROW_ON_ERROR')) {
            define('JSON_THROW_ON_ERROR', 0);
        }

        $res = json_decode($value, $assoc, 512, JSON_THROW_ON_ERROR);
        if (JSON_THROW_ON_ERROR == 0 && json_last_error() !== JSON_ERROR_NONE) {
            throw new Exception([
                'There was error while decoding JSON',
                'code'  => json_last_error(),
                'error' => json_last_error_msg(),
            ]);
        }

        return $res;
    }
protected function jsonDecode ( Field $ f , $ value , $ assoc = true ) { // constant supported only starting PHP 7.3 if ( ! defined ( 'JSON_THROW_ON_ERROR' ) ) { define ( 'JSON_THROW_ON_ERROR' , 0 ) ; } $ res = json_decode ( $ value , $ assoc , 512 , JSON_THROW_ON_ERROR ) ; if ( JSON_THROW_ON_ERROR == 0 && json_last_error ( ) !== JSON_ERROR_NONE ) { throw new Exception ( [ 'There was error while decoding JSON' , 'code' => json_last_error ( ) , 'error' => json_last_error_msg ( ) , ] ) ; } return $ res ; }
JSON decoding with proper error treatment.

@param Field  $f
@param string $value
@param bool   $assoc

@return mixed
JSON decoding with proper error treatment .