Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to parsing Json Array in Javascript?

Json Array as following is easy to parse,

{
    "movieCategories": [
       "a" : "Animation",
         "b" :"Romance",
        "c" :"Science Fiction"
       "d" : "Western"
    ]
}

Now,I have a Json response as following which is stored in movies.json file.

{
    "movieCategories": [
        "Animation",
         "Romance",
        "Science Fiction",
        "Western"
    ]
}

I am not sure how to parse the above json array. Kindly help.

Thank you.

like image 639
Gendaful Avatar asked Jan 28 '26 06:01

Gendaful


1 Answers

Assume

    var test = {
    "movieCategories": [
        "Animation",
         "Romance",
        "Science Fiction"
        "Western"
    ]
}

then

test.movieCategories[0] // Will be Animation
like image 97
Gfox Avatar answered Jan 30 '26 20:01

Gfox



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!