TypeError: Converting circular structure to JSON
I run into this issue, because i was sending as response the full response of another api call instead of just the data i needed.
TypeError: Converting circular structure to JSON
I run into this issue, because i was sending as response the full response of another api call instead of just the data i needed.
json stringify close circle
const getCircularReplacer = () => {
const seen = new WeakSet();
return (key, value) => {
if (typeof value === "object" && value !== null) {
if (seen.has(value)) {
return;
}
seen.add(value);
}
return value;
};
};
JSON.stringify(circularReference, getCircularReplacer());
UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
I also ran into this issue. It was because I forgot to await for a promise.
javascript circular evaluation
Game.prototype.restart = function () {
this.clearLocalStorage();
this.timer = setTimeout(this.reset.bind(this), 0); // bind to 'this'
};
Game.prototype.reset = function(){
this.clearBoard(); // ahhh, back in the context of the right 'this'!
};
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us