Y
Hacker News
new
|
ask
|
show
|
jobs
by
HanyouHottie
93 days ago
Instead of using the reviver you can deserialize as a plain string, then later reassign the property as the type you want. E.g.:
const myObject = JSON.parse(text); myObject.date = new Date(myObject.date);