how to solve (Uncaught TypeError: Converting circular structure to JSON)

how to solve (Uncaught TypeError: Converting circular structure to JSON)

我有以下对象,我正在尝试将其转换为 json 对象,如下所示

 var feeTransactionsArray=[];

                 $(".editor #newPayTable .mainTr").each(function(){ 

                     var feeTransactions={};
                     var studentDetails={};
                     var feeCategory={};


                     studentDetails['studentAdmissionId']=id;

                     feeCategory['feeCatId']=$(this).find('.feeCatId').val();

                     feeTransactions['studentDetails']=studentDetails;

                     feeTransactions['feeCategory']=feeCategory;

                     feeTransactions['paidOn']=paidDate;

                     feeTransactions['transReceiptNo']=receciptNumber;

                     feeTransactions['amountPaid']=$(this).find('.amount').val();

                     feeTransactions['paymentMode']=mode

                     feeTransactions['amountPaid']=refrenceNumber;

                     feeTransactions['isConcessionGiven']='no';

                     feeTransactionsArray.push(feeTransactionsArray);
                 });
                 var myJSON = JSON.stringify(feeTransactionsArray);

这会产生以下错误

actions.js:1180 Uncaught TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)

我的情况如何解决这个问题。请帮我。谢谢!

无法在 JSON 中对循环结构进行字符串化。让我们看一个例子:

var a = { a: undefined };
var b = { b: a };
a.a = b;

然后,我们有一个对象:

{ a: { b: { a: { b : { a ... infinite recursion

...这会导致您描述的错误。

对不起大家这是我愚蠢的错误

feeTransactionsArray.push(feeTransactionsArray);

应该是feeTransactionsArray.push(feeTransactions);