Custom AJAX Endpoint not returning any result

You need to use the defined namespace as the prefix for the add_action callbacks so that PHP knows which function it is supposed to call. More on this here, add_action in namespace not working

The add_actions should look like this then,

add_action('wp_ajax_ajax_endpoint', __NAMESPACE__ . '\\ajax_endpoint');
add_action('wp_ajax_nopriv_ajax_endpoint', __NAMESPACE__ . '\\ajax_endpoint');

When doing development work it is a good idea to have debugging on so that you can check debug.log for error messages, which usually tell you what is wrong with the code and why it isn’t working. Debugging in WordPress

As a side note, for sending a json response you can also use wp_send_json(), wp_send_json_error(), and wp_send_json_success().