GET request return value as error instead of success

On line 252 you are using print_r() inside your code, which is printing out an error message before the proper response, so your response is not valid JSON anymore.

If, as it appears, you want to include the output of print_r() in your error log, and not include it in the response, you need to set the second argument so that the value of print_r() is returned, and not printed:

error_log( "get_detail =" . print_r( $data, true ) );