TypeError: Converting circular structure to JSON
The "Converting circular structure to JSON" error occurs when we pass an object that contains circular references to the JSON.stringify() method. To solve the error, make sure to remove any circular references before converting the object to JSON.
There are two solution to it :
- Just copy the array/object to new variable and pass it to the parent array/object
- Check the getCircularReplacer() method code block.