3

I have a JSON object of format:

obj { 
    name: "abc" , 
    entriesList : "list of entry obj" , 
    propertiesList : "list of properties obj" 
};

where entry is also another object

entry { 
    info : "data obj" , 
    age : "15" , 
    subjects : "5"
}
properties { 
    a : "a" ,  
    b : "b" 
}
data { 
    c : "c" , 
    d : "d"
}

Using JSON.stringify() it is giving error

cyclic object value

How should I convert my object to JSON string?

Mariusz Jamro
  • 30,615
  • 24
  • 120
  • 162
user3505394
  • 315
  • 5
  • 18

1 Answers1

1

I can't see a cycle from your example, but the idea is to not include cyclic references in your object. I mean to avoid something like this:

var a = {}, b = {};
a.child = b;
b.child = a; //This will cause a cyclic reference when calling JSON.stringify both on a and b object
edrian
  • 4,501
  • 5
  • 31
  • 35
  • I understood not to include cycles references and I can't see cyclic references as well.But I am getting error as cyclic object value. – user3505394 May 26 '15 at 03:55