title: loop through json, make Multidimensional array
body: <p>I have some json like so</p>
  
  <pre><code>[{
    "merchantcontract":"Kevin\u0027s Radiator and Auto Repair 1916.01",
    "merchantcontractid":"60dccd9d-1114-e111-8a4f-00155d010302",
    "smi_transactiondate":"\/Date(1332918000000)\/",
    "smi_glamount2":2.1800,
    "smi_transactionclass":180870001,
    "smi_transactionclassname":"Residual Agent Commission",
    "smi_contractprodcutidname":"Traditional",
    "smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
    "smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
   },{
    "merchantcontract":"Kevin\u0027s Radiator and Auto Repair 1916.01",
    "merchantcontractid":"60dccd9d-1114-e111-8a4f-00155d010302",
    "smi_transactiondate":"\/Date(1333004400000)\/",
    "smi_glamount2":0.9700,
    "smi_transactionclass":180870001,
    "smi_transactionclassname":"Commercial Agent Commission",
    "smi_contractprodcutidname":"Traditional",
    "smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
    "smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
   },{
    "merchantcontract":"Kevin\u0027s Radiator and Auto Repair 1916.01",
    "merchantcontractid":"60dccd9d-1114-e111-8a4f-00155d010302",
    "smi_transactiondate":"\/Date(1333090800000)\/",
    "smi_glamount2":1.6200,
    "smi_transactionclass":180870001,
    "smi_transactionclassname":"Residual Agent Commission",
    "smi_contractprodcutidname":"Traditional",
    "smi_agentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5",
    "smi_primaryagentid":"1d3f44ee-afc3-e011-addf-a4badb1ddef5"
  }]
  </code></pre>
  
  <p>How can I make a Multidimensional array that looks like this. I need the first and the third smi_glamount2 that are Residual Agent Commission added together and added to the array </p>
  
  <pre><code>merchantcontractarray[Kevin\u0027s Radiator and Auto Repair 1916.01][merchantcontract]
  merchantcontractarray[Kevin\u0027s Radiator and Auto Repair 1916.01][Residual Agent Commission]
  merchantcontractarray[Kevin\u0027s Radiator and Auto Repair 1916.01][Residual Agent Commission][smi_glamount2 + smi_glamount2]
  merchantcontractarray[Kevin\u0027s Radiator and Auto Repair 1916.01][Commercial Agent Commission][[0.9700]
  </code></pre>
  
  <p>I have tried using this</p>
  
  <pre><code>$.each(data, function(i, field) {
      if (currentid == field.merchantcontract) {
          if (currentclassname == field.smi_transactionclass) {
              if (field.smi_transactionclass == '180870001') {
                  residual = residual + field.smi_glamount2;
              } else if (field.smi_transactionclass == '180870000') {
                  upfront = upfront + field.smi_glamount2;
              }
          } else {
              currentclassname = field.smi_transactionclass;
              if ($.inArray(currentclassname, smi_transactionclass) == -1) {
                  smi_transactionclass[i].push(currentclassname);
              }
          }
      } else {
          currentid = field.merchantcontract;
          if ($.inArray(currentid, merchantcontract[1]) == -1) {
              merchantcontract[i].push(currentid);
          }
          //console.log(currentid);
      }
  });​
  </code></pre>
  
  <p>With no such luck</p>
  
  <p>Any help is appreciated, I have made a jsfiddle, I really just need to see the array in the console.log.</p>
  
  <p><a href="http://jsfiddle.net/qs2nR/" rel="nofollow">http://jsfiddle.net/qs2nR/</a></p>