I have a weird JSON object. I am not sure how to iterate over it to get the values.
I can read a particular value but at a loss what to do next.
 var sku_object = {
   "SkuDevices": {
      "cb_skus": [
         {
            "XCZU9EG-1E": [
               {
                  "x_speed_alias": [
                     {
                        "$": 1
                     }
                  ],
                  "x_speed": [
                     {
                        "$": 1
                     }
                  ],
                  "device_speed": [
                     {
                        "$": "1REL"
                     }
                  ],
                  "hardware_product": [
                     {
                        "$": "XCZU9EG"
                     }
                  ],
                  "device_grade": [
                     {
                        "$": "E"
                     }
                  ],
                  "status": [
                     {
                        "$": "Active"
                     }
                  ]
               }
            ],
            "XCZU9EG-2I-4522": [
               {
                  "x_speed": [
                     {
                        "$": 2
                     },
                     {
                        "$": 2
                     }
                  ],
                  "x_speed_alias": [
                     {
                        "$": 2
                     }
                  ],
                  "spec_class": [
                     {
                        "$": "SCD"
                     }
                  ],
                  "device_speed": [
                     {
                        "$": "2REL"
                     }
                  ],
                  "x_spec_suffix": [
                     {
                        "$": 4522
                     }
                  ],
                  "spec_name": [
                     {
                        "$": "SCD4522"
                     }
                  ],
                  "hardware_product": [
                     {
                        "$": "XCZU9EG"
                     }
                  ],
                  "x_silicon_stage": [
                     {
                        "$": "PROD"
                     }
                  ],
                  "device_grade": [
                     {
                        "$": "I"
                     }
                  ],
                  "status": [
                     {
                        "$": "Active"
                     }
                  ]
               }
            ]
         }
      ],
      "device": [
         {
            "$": "ZU9EG"
         }
      ]
   }
}
alert (sku_object.SkuDevices["cb_skus"][0]["XCZU9EG-1E"][0]["device_speed"][0]["$"])
If you see the last line I can read a particular value.
Now under cb_skus -> XCZU9EG-1E and XCZU9EG-2I-4522 are different and it can be anything.
Again under XCZU9EG-2I-4522 the number of attributes differ.
I can only think so far:
 for (var i = 0, len = sku_object.XxpubSkuDeviceCollection.cb_skus.length; i < len; ++i) {
     var ss= sku_object.XxpubSkuDeviceCollection.cb_skus[i];
     alert (ss["XCZU9EG-1E"][0]["device_speed"][0]["$"])
 }
This doesnt really iterate over. Also how to get the keys like "device_speed"?
I should have added, the reason I am trying to iterate over it is to build a JSON object with the weird $ symbols. Something like this:
{
    "device" : "zu9eg",
    "cb_skus" : {
            "XCZU9EG-1E" : {"hardware_product" : "XCZU9EG",
                            "device_speed" : "1REL",
                            "x_speed" : "1",
                            "device_grade" : "E",
                            "status" : "active"
            },
            "XCZU9EG-2I-4522" : {"hardware_product" : "XCZU9EG",
                                 "device_speed" : "2REL",
                                 "x_speed" : "2",
                                 "x_speed_alias" : "2",
                                 "device_grade" : "I",
           }
    }
}
 
     
     
    