function dealNull(obj){
for(var i in obj){
if(null == obj[i] || 'null' == obj[i]){
obj[i]='';
}else if('object' == typeof obj[i]){
dealNull(obj[i]);
}
}
};
// 测试的对象
var a={};
a.aa=null;
a.bb='null';
a.c=1;
a.b={};
a.b.aaa=null;
a.b.bbb='null';
a.b.c=1;
a.array=[];
a.array.push({'a':null,'b':'null','c':1});
a.array.push({'a1':null,'b1':'null','c1':1});
a.array.push({'a2':null,'b2':'null','c2':1});
dealNull(a);
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn