change if(data[k]) to if(data.hasOwnProperty(k)