-1

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!

2
  • You should call states[i].simulation.config_map not states[i].simulation.configMap Commented Feb 24, 2015 at 6:58
  • configMap or config_map? Commented Feb 24, 2015 at 6:58

2 Answers 2

2

Check for testState.states[i].simulation.config_map instead of testState.states[i].simulation.configMap

Sign up to request clarification or add additional context in comments.

1 Comment

that was emberassing. Working with other people's code gets messy haha sorry for being an idiot
1

use this for first element

testState.states[0].simulation.config_map;

or

testState.states[i].simulation.config_map;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.