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

前端 未结 2 574
被撕碎了的回忆
被撕碎了的回忆 2021-01-07 13:52

i have the following object and i am trying to convert it to json object as follows

 var feeTransactionsArray=[];

                 $(\".editor #newPayTable          


        
相关标签:
2条回答
  • 2021-01-07 14:34

    sorry every one its my silly mistake

    it feeTransactionsArray.push(feeTransactionsArray);

    should be feeTransactionsArray.push(feeTransactions);

    0 讨论(0)
  • 2021-01-07 14:42

    It is not possible to stringify a circular structure in JSON. Lets see a single example:

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

    Then, we have an Object:

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

    ... this results into an error you described.

    0 讨论(0)
提交回复
热议问题