Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught SyntaxError: Unexpected token e in JSON at position 0 for getObject method #344

Open
aarunya opened this issue Jun 25, 2021 · 1 comment
Labels

Comments

@aarunya
Copy link

aarunya commented Jun 25, 2021

Try to get the object of cookies use method getObject(<cookie_name>)
but after run the code it shows following error -

zone.js:199 Uncaught SyntaxError: Unexpected token e in JSON at position 0
at JSON.parse ()
at CookieService.getObject (ngx-cookie.js:187)
at cookieComponent.push../src/app/shared/entity/cookies/cookie-consent/cookie-consent.component.ts.cookieComponent.removeGoogleCookies (cookie-consent.component.ts:50)
at cookie-consent.component.ts:82
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:498)
at invokeTask (zone.js:1744)
at globalZoneAwareCallback (zone.js:1781)

@aarunya aarunya added the bug label Jun 25, 2021
@salemdar
Copy link
Owner

Is the cookie really a valid JSON? The error indicates that the cookie string is not parsable to JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants