I'm working on a small project and I wanted to export an array of JSON objects into a text file. I came across this handy console.save() function for Chrome Dev Tools, and decided to use it. My library, leapcapjs has an exposed function that is the following:
LeapCap.getSavedFrames = function(){
return SAVED_FRAMES;
}
where SAVED_FRAMES is a global variable. In order to export this array to a string, I typed the following into my dev console:
console.save(LeapCap.getSavedFrames());
As a result, I get the following error:
TypeError: Converting circular structure to JSON
Anyone know what the problem could be? Thanks!
EDIT: SAVED_FRAMES is populated with frameData objects:
SAVED_FRAMES.push(frameData);
A frameData object is made like this:
LEAP_CONTROLLER.on('frame', function (frame) {
if (!PAUSE_LEAP) {
var frameData = {
'interaction_box': frame.interactionBox,
'hands': frame.hands
};
drawWith(frameData);
}
});
Could some of the LeapJS API objects be causing the problem? If so, how can I stop this?
SAVED_FRAMESpoint to itself anywhere?SAVED_FRAMESis populated. Maybe that might help.