Earlz Earlz - 1 year ago 113
JSON Question

Define "cyclic data structures"

At the JSON site it says


JSON does not support cyclic data
structures, so be careful to not give
cyclical structures to the JSON
stringifier.


What does it mean by this? Can someone give me an example of such a data structure in Javascript?

Answer Source
var cyclic = {};
cyclic.somekey = cyclic;
cyclic.another = "Hello world!";

Now you can do this, for example:

alert(cyclic.somekey.somekey.somekey.another);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download