3 ms·
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(
by HanyouHottie 7mo 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);