I'm new to JSON and ajax, but i'm trying to access data in an array where the items are enumerated in a sub array within another sub array. I run into problems with I try to access something like
data.items[0].details.specs[1].name
data.items[0].details.specs[1].id
data.items[0].details.specs[2].name
data.items[0].details.specs[2].id
etc
Can anyone point me in the right direction on how to access this properly? Thanks.
Update: Here's a clarification to my question with what the JSON response looks like:
{data:{
items: [
{details: {specs:[{name:'something1', id:'something1'},
{name:'something2', id:'something2'},
{name:'something3', id:'something3'},
...
]}}
{details: {specs:[{name:'somethingA', id:'somethingA'},
{name:'somethingB', id:'somethingB'},
{name:'somethingC', id:'somethingC'},
...
]}}
{details: {specs:[{name:'somethingX', id:'somethingX'},
{name:'somethingY', id:'somethingY'},
{name:'somethingZ', id:'somethingZ'},
...
]}}
]}
}
How would I access, for example, 'name:somethingB'?