我有以下JSON代码。如何使用JavaScript或jQuery解析转换为变量:name
,meetup
标签?
这是我的代码:
{
"MYID": 1,
"module": [
{
"name": "Manchester",
"meetup": "First Monday of every month",
"tags": [
"gtug",
"google",
"manchester",
"madlab"
]
},
{
"name": "jQuery Group",
"meetup": "First Tuesday of every month",
"tags": [
"jquery",
"javascript",
"jresig",
"madlab"
]
},
{
"name": "Hybrid!",
"meetup": "First Monday of every month",
"tags": [
"jquery",
"javascript",
"jresig",
"madlab"
]
}
]
}
答案 0 :(得分:0)
希望这会回答你的问题吗?
var json = JSON.parse("...");
for (var i = 0; i < json.module.length; i++) {
var mod = json.module[i];
var name = mod.name;
var meetup = mod.meetup;
var tags = mod.tags;
}