hellSigma
hellSigma

Reputation: 291

How to parse through JSON file using javascript?

I'm trying to parse through the following JSON file using Javascript. Can somebody help me with how to retrieve the data from this kind of JSON structure?

{
    "game_schedule": [
            {
                "day1":{
                    "date": "05/21/2016",
                    "time": ["09:06 am", "12:00 pm", "08:05 pm"],
                    "game": [
                        "SF Giants vs NY Mets",
                        "LA Dodgers vs SD Padres",
                        "SF Giants vs SD Padres"
                        ]
                },
                "day2":{
                    "date": "05/22/2016",
                    "time": ["09:06 am", "04:09 pm"],
                    "game": [
                        "LA Dodgers vs SF Gaints",
                        "LA Dodgers vs NY Mets"
                        ]

            }
        }
    ]  
}

Upvotes: 1

Views: 102

Answers (1)

vol7ron
vol7ron

Reputation: 42179

var obj = JSON.parse( json_string );

// obj['game_schedule'][0]['day1']['date'] == '05/21/2016'

Upvotes: 1

Related Questions