Reputation: 133
I am attempting to define an array of objects, each of which contains an object within text in javascript. I have the following code
testState={id : 'blahdu3',
states: [{
simulation : {
num_devices: 14,
num_networks: 6,
simulation_name: 'Jeffs sim',
id : 'blahdu3',
config_map : {
'Partition1': {
'networka' : { 'devicea' : '1', '[email protected]': '2', '[email protected]':'3'},
'networkb' : { 'deviced': '4', 'devicee': '5'},
},
'Partition2':{
'networkc' :{ 'devicef': '6', '[email protected]' : '7', '[email protected]': '8'},
'networkd' :{'[email protected]':'9', '[email protected]': '10'},
'networkTest' :{},
},
'Partition3':{
'networke' : { 'devicek':'11'}
},
'freelist' : {'devicew': '13', 'evicex' : '14'}
}
},
timestamp: '2015-01-012:44:00',
}]
}
The problem is that when I attempt to call this "configMap" with states[i].simulation.configMap; I am told that the configMap is a null object. Can anyone clarify what's going on here for me? Thanks a ton for the help!
Upvotes: -1
Views: 55
Reputation: 60
use this for first element
testState.states[0].simulation.config_map;
or
testState.states[i].simulation.config_map;
Upvotes: 1
Reputation: 1477
Check for testState.states[i].simulation.config_map
instead of testState.states[i].simulation.configMap
Upvotes: 2