I get a JSON from a REST API through Ajax if i write the result into console and copy it into a string variable (jsonInput) JSON.parse works fine, but if i directly use data(ajax result)it is undefined. I checked both variables and there are equal?
let jsonInput =
'{"pollId":49,
"question":"sdf",
"multipleAnswer":0,"answers":
[{"pollAnswerId":69,"answer":"sdf"},
{"pollAnswerId":70,"answer":"fsdf"}]}'
console.log(data === jsonInput); //TRUE
json = JSON.parse(data); //undefined
json = JSON.parse(jsonInput); //succesfull parsed