SessionStorage and json objects
Set the item
sessionStorage.setItem('user', user)
Get the item
var item = sessionStorage.getItem('user')
var user = item ? JSON.stringify(item) : {}
Apparently for Typescript users in React for example, You'll have to pass it as a string
JSON.parse(`${sessionStorage.getItem("session storage item name")}`)
Convert it to JSON before saving it.
$window.sessionStorage.user = JSON.stringify(user);
Then when you're loading it, parse the JSON.
var user = JSON.parse($window.sessionStorage.user);