A
A
Alexander Ivanov2019-05-14 11:15:46
JavaScript
Alexander Ivanov, 2019-05-14 11:15:46

What could be the reason for the Unexpected token a in JSON at position error?

I pass data to the back, it returns 200 status and generates what it should.
however, the promise(subscribe) gives this error to the console

ps the project is written in angular - complete nonsense, part of it is sewn into node_modules
____
SyntaxError: Unexpected token a in JSON at position 1
at JSON.parse ()
at XMLHttpRequest.onLoad ( localhost:4200/vendor .js:13122:51 )
at ZoneDelegate.push../node_modules/ zone.js/dist/zone.js.ZoneDelegate.invokeTask ( localhost:4200/polyfills.js:2737:31 )
at Object.onInvokeTask ( localhost:4200 /vendor.js:42557:33 )
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask ( localhost:4200/polyfills.js:2736:36 )
at Zone.push../node_modules/ zone.js/dist/zone.js.Zone.runTask ( localhost :4200/polyfills.js:2504:47 )
at ZoneTask.push../node_modules/ zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] ( localhost:4200/polyfills.js:2812:34 )
at invokeTask ( localhost:4200/polyfills.js:3856:14 )
at XMLHttpRequest.globalZoneAwareCallback ( localhost:4200/polyfills.js:3882:17 )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeniy Samoilenko, 2019-05-14
@cimonlebedev

Server response is invalid JSON. It's written in the error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question