I\'ve got the following...
chrome.extension.sendRequest({
req: \"getDocument\",
docu: pagedoc,
name: \'name\'
}, function(response){
var efjs = respo
I normally use the circular-json npm package to solve this.
// Felix Kling's example
var a = {};
a.b = a;
// load circular-json module
var CircularJSON = require('circular-json');
console.log(CircularJSON.stringify(a));
//result
{"b":"~"}
Note: circular-json has been deprecated, I now use flatted (from the creator of CircularJSON):
// ESM
import {parse, stringify} from 'flatted/esm';
// CJS
const {parse, stringify} = require('flatted/cjs');
const a = [{}];
a[0].a = a;
a.push(a);
stringify(a); // [["1","0"],{"a":"0"}]
from: https://www.npmjs.com/package/flatted