当JavaScript中存在未定义的值时,无法解析json

I have this json [object Object],[object Object],[object Object],[object Object],,,[object Object], You can see that there 3 undefined object. When I parse this json file I use this;

for (x=0;x<json.length;x++) {
src=json[x].file.src
list.push(src)
}

当x变为4(未定义)时,它将停止工作。如果未定义,我该怎么说脚本才能跳过此对象。