toJSON and fromJSON implementations
Working JSON everything and localstorage