Converting circular structure to JSON --> starting at object with constructor 'TakeUntilSubscriber' | property '_parentOrParents' -> object with constructor 'Subscriber' code example
Example: 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());