javascript: parse JSON

$.get(“/intra/do/sequence_has_codonList.pl”,function(data){
        data = JSON.parse(data); // array of objects
        for(var i = 0, n = data.length; i<n; i++) {
            for(var j = 0, codons = data[i].codons, m = codons.length; j<m; j++) {
                if (codons[j] !== 0 ) {
                    var aa = codons[j].toUpperCase(), bb = data[i].abbr.toUpperCase(), cc = data[i].full;
                    codonIMap[aa] = bb;
                    codonFMap[aa] = cc;
                   // cannot be indexed, I don't know why.
                }
            }
        }
    });
posted @ 2016-10-12 13:19  乌祁班岚图  阅读(153)  评论(0编辑  收藏  举报