递归

var a = '{"renderer":"@@com.fProgress","filter":{"type":"list","store":"@@com.makeDs(com.D.marketProgress)","labelField":"name","idField":"value"}}'
var b = Ext.JSON.decode(a);
var arr = [];
function find(obj, fuhao) {
for (var k in obj) {
        if (obj.hasOwnProperty(k)) {
            if (typeof obj[k] === "object") {
                //console.log(k+'###'+'[Object]')
                find(obj[k], fuhao);
            } else {
                //console.log(k + '####' + obj[k])
                if (obj[k].indexOf(fuhao) !== -1) {
                    //找到包含该符号的值
                    arr.push(obj[k])
                    //console.log(obj[k]+"find fuhao")
                }
            }
        }
    }
}

find(b, "@@");

 

posted on 2018-04-07 09:28  xsSystem  阅读(111)  评论(0编辑  收藏  举报