JSON tree traversal in JQuery

I have stumbled upon that there are developers who cannot do that while looking over some questions at Stackoverflow.


function enterPercents(data) {
    if (data == '[]') return;
    var parsed = jQuery.parseJSON(data);
    if (parsed) {
        processJsonTree("jsonObject", parsed);
    }
}

function processJsonTree(path, node) {
    if (typeof node != 'object') {
        alert(path + " = " + node);
    } else {
        $.each(node, function (key, item) {
            var cpath = path + "[" + key + "]";
            processJsonTree(cpath, item);
        });
    }
}

enterPercents('{"day":{"1":2,"2":3,"3":4,"4":5},"week":{"1":1,"2":1,"3":1,"4":60},"month":{"1":10,"2":10,"3":10,"4":10},"sell":{"1":0,"2":0,"3":0,"4":0}}');