A cleaner way could be to json_encode the string casted $message variable.