user: {firstName: "loki", lastName: "ch"}
I am storing this user in session storage.
$window.sessionStorage.user = user;
when i retrieved it back using
$window.sessionStorage.user
, i got:
[object Object]
I want in JSON. Any suggestions?
Convert it to JSON before saving it.
Then when you're loading it, parse the JSON.
Set the item
Get the item
Apparently for Typescript users in React for example, You'll have to pass it as a string