title: Use Lodash to transform this nested json data
body: <p>I'm new to lodash. I have this kind of json data. I already have 90-120 lines of code that parses it, does some calculation to it, and creates new json. It's becoming a nightmare.</p>
  
  <p>I would like to ask help on how I can transform this json using lodash's methods.</p>
  
  <p><a href="http://pastebin.com/BjBLwJDA" rel="nofollow">http://pastebin.com/BjBLwJDA</a></p>
  
  <pre><code>[
      {
          "dates": [
              {
                  "datetime": "2014-08-26",
                  "deviceModels": [
                      {
                          "deviceModel": "Canon450MX",
                          "devices": [
                              {
                                  "deviceModel": "Canon450MX",
                                  "inchesPrinted": 10,
                                  "serialNum" : "111"
                              },
                              {
                                  "deviceModel": "Canon450MX",
                                  "inchesPrinted": 10,
                                  "serialNum" : "222"
                              },
                              {
                                  "deviceModel": "Canon450MX",
                                  "inchesPrinted": 10,
                                  "serialNum" : "333"
                              }
                          ]
                      },
                      {
                          "deviceModel": "HPDeskjet",
                          "devices": [
                              {
                                  "deviceModel": "HPDeskjet",
                                  "inchesPrinted": 20,
                                  "serialNum" : "444"
                              },
                              {
                                  "deviceModel": "HPDeskjet",
                                  "inchesPrinted": 20,
                                  "serialNum" : "555"
                              }
                          ]
                      }
                  ]
              },
              {
                  "datetime": "2014-08-27",
                  "deviceModels": [
                      {
                          "deviceModel": "Canon450MX",
                          "devices": [
                              {
                                  "deviceModel": "Canon450MX",
                                  "inchesPrinted": 5,
                                  "serialNum" : "111"
                              },
                              {
                                  "deviceModel": "Canon450MX",
                                  "inchesPrinted": 25,
                                  "serialNum" : "222"
                              },
                              {
                                  "deviceModel": "Canon450MX",
                                  "inchesPrinted": 15,
                                  "serialNum" : "333"
                              }
                          ]
                      },
                      {
                          "deviceModel": "HPDeskjet",
                          "devices": [
                              {
                                  "deviceModel": "HPDeskjet",
                                  "inchesPrinted": 10,
                                  "serialNum" : "444"
                              },
                              {
                                  "deviceModel": "gx420d",
                                  "inchesPrinted": 20,
                                  "serialNum" : "555"
                              }
                          ]
                      }
                  ]
              }
          ]
      }
  ]
  </code></pre>
  
  <p>I would like the new output json to be like this:</p>
  
  <pre><code>[
      { date : 2014-08-26, deviceModel : 'Canon450MX', totalInchesPrinted : 30 },
      { date : 2014-08-26, deviceModel : 'HPDeskJet', totalInchesPrinted : 40 },
      { date : 2014-08-27, deviceModel : 'Canon450MX', totalInchesPrinted : 45 },
      { date : 2014-08-27, deviceModel : 'HPDeskJet', totalInchesPrinted : 30 }
  ]
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>Thanks!</p>