I have an Array var cars = [2,3,..]
which holds a few integers.
I\'ve added a few values to the array, but I now need to send this array to a page via jQuery\'s
I decided to use the json2 library and I got an error about “cyclic data structures”.
I got it solved by telling json2 how to convert my complex object. Not only it works now but also I have included only the fields I need. Here is how I did it:
OBJ.prototype.toJSON = function (key) {
var returnObj = new Object();
returnObj.devid = this.devid;
returnObj.name = this.name;
returnObj.speed = this.speed;
returnObj.status = this.status;
return returnObj;
}