-2👍
UPDATE:
in your example you are trying JSON.stringify
on the response, so logically I assumed that it is an object (not stringified).
If they are both text, you can get them by the pattern as stated in above comments.
if(res.target.result.includes('<')){
// do the xml stuff
} else {
// json stuff
}
if there is a risk that JSON string will contain <
too, then you’ll need to further upgrade the if
old answer
you can use `typeof()` where xml will return a string, and object or array will return array or object
```js
this.inputFile = typeof(res.target.result) === 'string' ? res.target.result : JSON.stringify(res.target.result)
Source:stackexchange.com