I am trying to produce a grid of all the VM’s a client has running on an ESXi server. I get this data in json format (it is valid json as I’ve run it through several json validators). I’ve read the following:
Nested JSON
and am attempting to display a grid. A sample of the data is here:
{"ABC-DEV": {ABC-DEV-Cluster": "prd-esx1.abc.com": {},
"prd-esx2.abc.com": {"vm1": {"mem": "1500", "diskGB": "10.00", "cpu": "2", "state:"poweredOn"}},
{"vm2": {"mem": "1500", "diskGB": "40.00", "cpu": "1", "state:"poweredOn"}},
........}}
"ABC-PROD": {"ABC-PRD-Cluster": "prd-esx12.abc.com": {},
"prd-esx14.abc.com": {"vm12": {"mem": "1500", "diskGB": "10.00", "cpu": "2", "state:"poweredOn"}},
{"vm14": {"mem": "1500", "diskGB": "40.00", "cpu": "1", "state:"poweredOn"}},
........}}
and here is the source:
var source {
datatype: "json",
url: "vms.json",
datafields: [
name: 'mem', map: "ABC-PRD>ABC-PRD-Cluster>prd-esx14.abc.com>0>mem"},
.....
}
I would like my grid to look like this:
vm12 1500 10.00 2 poweredOn
.....
I’m not sure what the “0” in the datafields definition, and how to list the vm name, etc. Can anyone help me with how to properly define the data source for this data? Thanks.