I have a specific requirement to convert a JSON object to a string. However, simply using JSON.stringify() does not work due to circular references. After some research online, I came across a package that can handle this issue for me. The only problem is that the usage of the package includes the
const safeJsonStringify = require('safe-json-stringify');
syntax, which may be problematic as Angular 4 no longer supports the require()
function. The newer versions of Angular (starting from version 2) use import
statements instead. This means that if a class is exported within the package, we can directly import it.
Does anyone have any suggestions on how to address this?
Thank you in advance!!