stephen_araghun
12 years agoOccasional Contributor
Creating JSON from Testcomplete Objects
Hello Testcomplete Community!
I would like to know if it is possible to create JSON from testcomplete objects. So far this code fails when starting the For In loop:
function lookdeep(object){
var collection= [], index= 0, next, item;
for(item in object){
if(object.hasOwnProperty(item)){
next= object[item];
if(typeof next== 'object' && next!= null){
collection[index++]= item +
':{ '+ lookdeep(next).join(', ')+'}';
}
else collection[index++]= [item+':'+String(next)];
}
}
return collection;
}
The object supplied is from the objects spy on screen to a mapped object (in this case a gird.)
Thank you all in advance!
Stephen
I would like to know if it is possible to create JSON from testcomplete objects. So far this code fails when starting the For In loop:
function lookdeep(object){
var collection= [], index= 0, next, item;
for(item in object){
if(object.hasOwnProperty(item)){
next= object[item];
if(typeof next== 'object' && next!= null){
collection[index++]= item +
':{ '+ lookdeep(next).join(', ')+'}';
}
else collection[index++]= [item+':'+String(next)];
}
}
return collection;
}
The object supplied is from the objects spy on screen to a mapped object (in this case a gird.)
Thank you all in advance!
Stephen