0
我想瀏覽一個json對象,一次返回1個元素並遍歷。這是JSON。如何導航通過JSON對象
{
"noun": {
"syn": [
"leap",
"saltation",
"startle",
"start",
"parachuting",
"jumping",
"actuation",
"descent",
"inborn reflex",
"increase",
"innate reflex",
"instinctive reflex",
"physiological reaction",
"propulsion",
"reflex",
"transition",
"unconditioned reflex"
]
},
"verb": {
"syn": [
"leap",
"bound",
"spring",
"startle",
"start",
"leap out",
"jump out",
"stand out",
"stick out",
"rise",
"climb up",
"jump off",
"derail",
"chute",
"parachute",
"jumpstart",
"jump-start",
"pass over",
"skip",
"skip over",
"alternate",
"alter",
"appear",
"assail",
"assault",
"attack",
"change",
"climb",
"dive",
"drop",
"enter",
"go",
"leave out",
"locomote",
"look",
"miss",
"mount",
"move",
"neglect",
"omit",
"overleap",
"overlook",
"participate",
"plunge",
"plunk",
"pretermit",
"seem",
"set on",
"shift",
"start up",
"switch",
"travel",
"vary",
"wax"
],
"rel": [
"leap out",
"jump on"
]
}
}
比方說,我想訪問「飛躍」。這是兩層。我將如何1)返回跳躍,並且2)迭代到下一個單詞?
假設你的JSON對象是'obj','obj.noun.syn [0]'應該做我應該提到的伎倆 – Lukman
;我想將單詞存儲在變量中,並在遍歷數組時更新變量。 –
看看這個http://stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json – Manish