So i'm running a $.getJSON statement and i'm having some problems... here's the json:
{
"K-6608-1-0": [
{
"Info": [
{
"SVGFile": "46658.svg",
"Name": "Faucet Parts"
}
],
"Parts": [
{
"Cod":"70012",
"Name":"Ruela de Parafuso Reforçado B2",
"Price":"$100"
},
{
"Cod":"71131",
"Name":"Parafusasdasdasdsdao Reforçado B2",
"Price":"$45"
},
{
"Cod":"78208",
"Name":"Tubo de Conexão R2D2",
"Price":"$150"
}
]
}
]
}
So, let's say i've made the getJSON that way:
$.getJSON('test.json', function(data){
alert(data["K-6608-1-0"]["Info"]["SVGFile"]);
})
Why this code doesn't return "46658.svg"? Where's the error?
Thanks in advance ^^
data["K-6608-1-0"]is an array containing one element which is an object, so isInfo. You wantdata["K-6608-1-0"][0]["Info"][0]["SVGFile"]