While using SOAP to interact with our IPAM (Men and Mice), I find myself slightly frustrated by the fact that it returns nested object arrays which become flattened into simply a list of properties.
Is there any way of rehydrating these into actual Javascript objects?
For example, a simple list of IP ranges look like this:
+ parameter name: 'ranges.range[0].ref', value: '{#6-#553}'
+ parameter name: 'ranges.range[0].name', value: 'XX.YY.ZZ.0/24'
+ parameter name: 'ranges.range[0].from', value: 'XX.YY.ZZ.0'
+ parameter name: 'ranges.range[0].to', value: 'XX.YY.ZZ.255'
+ parameter name: 'ranges.range[0].parentRef', value: '{#6-#546}'
+ parameter name: 'ranges.range[0].childRanges', value: 'null'
+ parameter name: 'ranges.range[0].dhcpScopes', value: 'null'
+ parameter name: 'ranges.range[0].subnet', value: 'false'
+ parameter name: 'ranges.range[0].locked', value: 'false'
+ parameter name: 'ranges.range[0].inheritAccess', value: 'false'
+ parameter name: 'ranges.range[0].autoAssign', value: 'false'
+ parameter name: 'ranges.range[0].hasSchedule', value: 'false'
+ parameter name: 'ranges.range[0].hasMonitor', value: 'false'
+ parameter name: 'ranges.range[0].customProperties.property[0].name', value: 'Location'
+ parameter name: 'ranges.range[0].customProperties.property[0].value', value: 'Datacenter'
+ parameter name: 'ranges.range[0].customProperties.property[1].name', value: 'Title'
+ parameter name: 'ranges.range[0].customProperties.property[1].value', value: 'Dedicated iSCSI network 1'
+ parameter name: 'ranges.range[0].customProperties.property[2].name', value: 'vlan'
+ parameter name: 'ranges.range[0].customProperties.property[2].value', value: '5'
+ parameter name: 'ranges.range[0].isContainer', value: 'false'
+ parameter name: 'ranges.range[0].utilizationPercentage', value: '22'
+ parameter name: 'ranges.range[0].hasRogueAddresses', value: 'false'
+ parameter name: 'totalResults', value: '1'
+ parameter attribute name: '.(xmlns)', value: 'http://menandmice.com/webservices/'
To retrieve the range ref property from this response, I currently have to do something like:
rangeRef=outParameters["ranges.range[0].ref"]
Which is very inelegant once you need to retrieve a nested property on multiple objects.
I have a feeling that this list may in fact be deserializable through some standard method, but I am not experienced enough with JavaScript to know how...