如何使用javascript解析JSON文件?

时间:2016-05-01 01:54:28

标签: javascript json

我正在尝试使用Javascript解析以下JSON文件。有人可以帮助我如何从这种JSON结构中检索数据吗?

{
    "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"
                        ]

            }
        }
    ]  
}

1 个答案:

答案 0 :(得分:1)

var obj = JSON.parse( json_string );

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