question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when new value is not JSON

See original GitHub issue
SyntaxError: Unexpected token e in JSON at position 1
  at JSON.parse(<anonymous>)
  at current(./node_modules/use-persisted-state/dist/use-persisted-state.m.js:1:766)
  at n(./node_modules/@use-it/event-listener/dist/event-listener.m.js:1:199)
  at n(./node_modules/@sentry/browser/esm/helpers.js:70:1)

See line 12 below:

https://github.com/donavon/use-persisted-state/blob/02a847a8a46360cac1ee8f3c5ad3726875667c1e/src/usePersistedState.js#L11-L16

Other modules may use localStorage and not store JSON.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:13

github_iconTop GitHub Comments

26reactions
ricardo-devis-agullocommented, Aug 19, 2019

Hi, I see this got fixed.

Could you publish to NPM a new version for this fix? 😃

7reactions
michu2kcommented, Oct 3, 2019

Hi @donavon, so can you publish to NPM a new version with this fix 😃 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

is not JSON serializable error when adding new values to an ...
json.dumps doesn't write to streams, it simply takes the object and returns the JSON-serialized string. You can then save that to the file....
Read more >
JSON.stringify() - JavaScript - MDN Web Docs
The JSON.stringify() method converts a JavaScript value to a JSON string, ... Function , and Symbol values are not valid JSON values.
Read more >
HTTP status and error codes for JSON | Cloud Storage
An HTTP status code value, without the textual description. Example values include: 400 (Bad Request), 401 (Unauthorized), and 404 (Not Found).
Read more >
JSON_VALUE (Transact-SQL) - SQL Server - Microsoft Learn
If JSON_VALUE finds JSON that is not valid in expression before it finds the value identified by path, the function returns an error....
Read more >
Out of range float values are not JSON compliant
When i see this error, i found the cause of problem. If i use pandas and field value is NaN, that makes problem....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found