我想从 twitter api 检索到的 json 数组中检索趋势值。我需要前 5 个趋势名称。
json响应
[{
"trends": [
{
"name": "#NationalTellAGirlSheIsBeautifulDay",
"url": "http://twitter.com/search?q=%23NationalTellAGirlSheIsBeautifulDay",
"promoted_content": null,
"query": "%23NationalTellAGirlSheIsBeautifulDay",
"events": null
},
{
"name": "#YouKnowYouInTheHoodWhen",
"url": "http://twitter.com/search?q=%23YouKnowYouInTheHoodWhen",
"promoted_content": null,
"query": "%23YouKnowYouInTheHoodWhen",
"events": null
},
{
"name": "#DünyaFenerbahçelilerGünüKutluOlsun",
"url": "http://twitter.com/search?q=%23D%C3%BCnyaFenerbah%C3%A7elilerG%C3%BCn%C3%BCKutluOlsun",
"promoted_content": null,
"query": "%23D%C3%BCnyaFenerbah%C3%A7elilerG%C3%BCn%C3%BCKutluOlsun",
"events": null
},
{
"name": "#IndonesianTeenager",
"url": "http://twitter.com/search?q=%23IndonesianTeenager",
"promoted_content": null,
"query": "%23IndonesianTeenager",
"events": null
},
{
"name": "#bpk13",
"url": "http://twitter.com/search?q=%23bpk13",
"promoted_content": null,
"query": "%23bpk13",
"events": null
},
{
"name": "HaykırırımAşkımıSana BEŞİKTAŞdiye",
"url": "http://twitter.com/search?q=%22Hayk%C4%B1r%C4%B1r%C4%B1mA%C5%9Fk%C4%B1m%C4%B1Sana+BE%C5%9E%C4%B0KTA%C5%9Ediye%22",
"promoted_content": null,
"query": "%22Hayk%C4%B1r%C4%B1r%C4%B1mA%C5%9Fk%C4%B1m%C4%B1Sana+BE%C5%9E%C4%B0KTA%C5%9Ediye%22",
"events": null
},
{
"name": "Vogue Korea",
"url": "http://twitter.com/search?q=%22Vogue+Korea%22",
"promoted_content": null,
"query": "%22Vogue+Korea%22",
"events": null
},
{
"name": "PNG",
"url": "http://twitter.com/search?q=PNG",
"promoted_content": null,
"query": "PNG",
"events": null
},
{
"name": "Makueni",
"url": "http://twitter.com/search?q=Makueni",
"promoted_content": null,
"query": "Makueni",
"events": null
},
{
"name": "Jeremy Kyle",
"url": "http://twitter.com/search?q=%22Jeremy+Kyle%22",
"promoted_content": null,
"query": "%22Jeremy+Kyle%22",
"events": null
}
],
"as_of": "2013-07-19T09:23:13Z",
"created_at": "2013-07-19T09:14:10Z",
"locations": [
{
"name": "Worldwide",
"woeid": 1
}
]
}]
jQuery 代码
$.getJSON("url",function(data){
console.log(data);
});
如何从成功函数中的对象中检索值?