Q:

How to iterate over a json object list? 

i am struggling how to sum all the values of "B" in my json object.  I want the console log to show me the grand total of all the "B" values.  
var voltot = 0;

$.each(json,function(k,v){

    voltot = v.B += voltot ;

    //console.log(v. B);

});

console.log(voltot);

HERE IS MY FULL JSON OBJECT.  

var json=
[
    {
        "a": "OOCBER",
        "b": "OOCL BERLIN",
        "c": "CHINA",
        "d": "GREAT BRITAIN",
        "e": "*PI",
        "f": "NGB",
        "g": "CN",
        "i": "GB",
        "n": 9,
        "o": 6,
        "p": "2015-09-14",
        "q": "2015-09-14",
        "s": 4,
        "u": "40HC",
        "v": "TRLU7564566",
        "w": "CN0794909",
        "x": "LEIGH",
        "y": "NINGBO",
        "z": 395,
        "B": 68.8,
        "C": 7987.5,

    },
    {
        "a": "OOCBER",
        "b": "OOCL BERLIN",
        "c": "CHINA",
        "d": "GREAT BRITAIN",
        "e": "*PI",
        "f": "NGB",
        "g": "CN",
        "i": "GB",
        "n": 9,
        "o": 6,
        "p": "2015-09-14",
        "q": "2015-09-14",
        "s": 4,
        "u": "40HC",
        "v": "TCLU8306124",
        "w": "CN0786008",
        "x": "OXFORDSHIRE",
        "y": "NINGBO",
        "z": 412,
        "B": 68,
        "C": 8790.5,

    }
]

i am struggling how to sum all the values of "B" in my json object.  I want the console log to show me the grand total of all the "B" values.  
var voltot = 0;

$.each(json,function(k,v){

    voltot = v.B += voltot ;

    //console.log(v. B);

});

console.log(voltot);

A:

This is wrong
voltot = v.B += voltot ;

Make like this
voltot += v.B;

Or
voltot = v.B + voltot ;

A:

The preferred method to obtain an unique value from an array is the Array.prototype.reduce method, which takes a callback function and a starting value (it reduces an array to a single value).  You could use it this way :
json.reduce(function(total, current) { return typeof current. B === "number" ?  total + current. B : total; }, 0);

Here is a JSFiddle.