Disable JSON parsing in Axios

Ok I figured out how that would work. You can disable response processing by just passing the transformResponse Array in the config, which is then used instead of the the default. There you just provide an empty array or an array of functions you need to apply to your response, like this:

axios.get(URL, {transformResponse: []})
.then(response => {/*response.data is plain text*/});

LuleBes answer didnt work for me. What did work was: transformResponse: (res) => { return res; }, As in:

    axios.get(url, {
        headers,
        transformResponse: (res) => {
            // Do your own parsing here if needed ie JSON.parse(res);
            return res;
        },
        responseType: 'json'
    }).then(response => {
        // response.data is an unparsed string
    });

Set the following option to force axios not to parse the response:

transformResponse: x => x

Usage:

let response = await axios.get('/static/data.json', {
    transformResponse: x => x
});

Now response.data is a string as previously it was an object