src/Koldy/Json.php
public static function encode($data): string
    {
        $json = json_encode($data);

        if ($json === false) {
            $errNo = json_last_error();
            $msg = json_last_error_msg();
            throw new Exception("Unable to encode data to JSON, error ({$errNo}): {$msg}", $errNo);
        }

        return $json;
    }
public static function encode($data): string
    {
        $json = json_encode($data);

        if ($json === false) {
            $errNo = json_last_error();
            $msg = json_last_error_msg();
            throw new Exception("Unable to encode data to JSON, error ({$errNo}): {$msg}", $errNo);
        }

        return $json;
    }
public static function encode ( $ data ) : string { $ json = json_encode ( $ data ) ; if ( $ json === false ) { $ errNo = json_last_error ( ) ; $ msg = json_last_error_msg ( ) ; throw new Exception ( "Unable to encode data to JSON, error ({$errNo}): {$msg}" , $ errNo ) ; } return $ json ; }
JSON helper to quickly encode some data

@param mixed $data

@return mixed in JSON format
@throws Exception
@link https://koldy.net/framework/docs/2.0/json.md
JSON helper to quickly encode some data