【发布时间】:2011-03-06 15:31:09
【问题描述】:
我想获取一个 json 以仅在 div 中显示 syn。
类似:--
$.getJSON('http://words.bighugelabs.com/api/2/eba286cdc7f3619674544d80ce94cb1b/stack/json', function(data) {
//parse the response to display in a div
});
来自链接的 JSON 标记:
{
"noun": {
"syn": [
"batch",
"deal",
"flock",
"good deal",
"great deal",
"hatful",
"heap",
"lot",
"mass",
"mess",
"mickle",
"mint",
"muckle",
"peck",
"pile",
"plenty",
"pot",
"quite a little",
"raft",
"sight",
"slew",
"spate",
"tidy sum",
"wad",
"push-down list",
"push-down stack",
"smokestack",
"push-down storage",
"push-down store",
"agglomerate",
"chimney",
"cumulation",
"cumulus",
"large indefinite amount",
"large indefinite quantity",
"list",
"listing",
"memory device",
"mound",
"storage device",
"whole lot",
"whole slew"
]
},
"verb": {
"syn": [
"pile",
"heap",
"arrange",
"lade",
"laden",
"load",
"load up",
"set up"
],
"rel": [
"heap up",
"pile up",
"stack away",
"stack up"
]
}
}
【问题讨论】:
-
@Matt 不是 json.. 检查我在代码中提供的链接..
-
你有两个数组。名词.syn 和动词.syn。您可以使用 for 循环并遍历这两个数组并做任何您想做的事情。