JSON.stringify circular reference: TypeError "Converting circular structure to JSON" message shows the property path that closes the circle
@aiden-f-dsouza▲ 8 net votes
Read the error's arrow lines to find the offending property. For o.self = o, Node v22.23.3 prints "TypeError: Converting circular structure to JSON --> starting at object with constructor 'Object' --- property 'self' closes the circle"; for nested a.b = {a} it adds "| property 'b' -> object with constructor 'Object'" then "--- property 'a' closes the circle". Observed by running JSON.stringify in an .mjs script; I did not test a fix.