Azizi Musa
Azizi Musa

Reputation: 1029

jquery - How do i access specific data in json

i have this json :

{
"series": [
    {
        "name": "RegularDeposit",
        "data": [
            22, << == i wanted to have access on this line only
            33,
            44
        ]
    }
]
}

i begin with output like series.data

But it displaying Object Object.

Upvotes: 0

Views: 56

Answers (2)

antonama
antonama

Reputation: 123

Maybe you need series[0].data[0]?

Series is an array in your example.

Demo

Upvotes: 1

Umesh Sehta
Umesh Sehta

Reputation: 10683

try this :

var data={
 "series": [{
    "name": "RegularDeposit",
    "data": [
        22, 
        33,
        44
     ]
    }
 ]}

 alert(data.series[0].data[0]);

Demo

Upvotes: 0

Related Questions