Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JSON source data
- [
- {
- "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"
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- // I'm aiming for this kind of output
- [
- { 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 }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement