You can use dojox.json.ref
to find circular references. This code prints json representation of your objectWithCircularReferences
:
require(["dojox/json/ref"], function(){
console.log(dojox.json.ref.toJson(objectWithCircularReferences));
});
Any occurence of "$ref" substring in its output to console will help you locate circular references. You can alternatively pipe this json output to global variable ZZZ like this if you wish:
require(["dojox/json/ref"], function(){
window.ZZZ = dojox.json.ref.toJson(objectWithCircularReferences);
});
And of course you need to include dojo library beforehand. In an html file:
<script src="//yandex.st/dojo/1.9.1/dojo/dojo.js"></script>
In firebug console:
include("//yandex.st/dojo/1.9.1/dojo/dojo.js")
In Chrome console:
SCRIPT = document.createElement('script');
SCRIPT.src = '//yandex.st/dojo/1.9.1/dojo/dojo.js';
document.body.appendChild(SCRIPT);