I am consuming an API that return JSON. The JSON syntax returned by API is broken and I have no control to get it fixed. 

I am using JQuery Ajax call and it returns *500 - Internal Server Error*. I want to get API response and plain text and fix the JSON syntax. it just has an additional comma at the end which I can remove. But I am not able to get the response as plain text.

I have tried several approaches such as setting content-type and/or accept headers to plain text using dataType to plain text as below. My code is as below.

```
$.ajax({
    url: apiUrl + "/" + customerId + "/accounts/" + accountId,
    data: "client_id=" + clientId,
    dataType: 'text',
    type: 'GET',
    async: true,
    statusCode: {
        404: function (response) {
            console.log('Invalid Transaction details');
        },
        200: function (response) {
            //response processing code here
        }
    },
    error: function (jqXHR, status, errorThrown) {
        //Error handling routine
    }
});

```

**Update 1**
The API works fine when directly called from browser or fiddler. That's how I come to know that JSON syntax is broken.