Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
175
rated 0 times [  180] [ 5]  / answers: 1 / hits: 32115  / 11 Years ago, mon, july 22, 2013, 12:00:00

I need to access the State value from the following array --



data =   
{
Images:
[
{
ProductCodes: [],
BlockDeviceMappings: [Object],
Tags: [],
ImageId: 'ami-75301c',
ImageLocation: '54696560/Test Image 3',
State: 'available',
VirtualizationType: 'pavirtul',
Hypervisor: 'xen'
}
],
requestId: '2eb809d3-7f82-4142-b5d1-6af3'
}


When I try data.Images[State] or data.Images.State I get undefined.



Thanks


More From » arrays

 Answers
5

Images maps to an array which stores objects, so you have to specify the index of the item you want. Try data.images[0][State].


[#76818] Sunday, July 21, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eden

Total Points: 730
Total Questions: 117
Total Answers: 117

Location: Peru
Member since Fri, Oct 14, 2022
2 Years ago
;