function createRandomObj(params,subobjs){
function getRandomString(size){
var p = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var f='';
for(var i=0;i<size;i++){
f+=p[Math.floor(Math.random()*p.length)];
}
}
var o={};
for(var i=0;i<params;i++){
var co;
var sd=Math.floor(Math.random()*(subobjs?6:5)
switch(sd){
case 0:
co=Math.floor(Math.random()*1000);
break
case 1:
co=Math.random();
break;
case 2:
co=Math.random()<0.5?true:false;
break;
case 3:
co=getRandomString(Math.floor(Math.random()*4)+4);
break;
case 4:
co=null;
break;
case 5:
co=createRandomObj(params,subobjs);
break;
}
o[getRandomString(8)]=co;
}
return o;
}
It will create a obj with X paramenters, all with a integer, float, string, boolean or null value.
I just made it :B