gsklee / ngStorage

localStorage and sessionStorage done right for AngularJS.
MIT License
2.33k stars 461 forks source link

Unexpected token e in JSON #224

Closed ghost closed 8 years ago

ghost commented 8 years ago

I have used the following to change the prefix value used by ngStorage: $localStorageProvider.setKeyPrefix('wikitime_'); $sessionStorageProvider.setKeyPrefix('wikitime_');

However, by doing so, I get the following error: angular.js:13642 SyntaxError: Unexpected token e in JSON at position 0

Have any idea why this happens and how can I fix it?

egilkh commented 8 years ago

Hey there.

Could you provide and example that fails? Or does it always fail when you use those prefixes?

ghost commented 8 years ago

Hey!

I think I understood now why this was happening. I had another key with the same prefix that was not serialized. The value of this key started exactly with the letter e. So, I guess the problem does not have nothing to do with ngStorage. I will close this issue!