我想显示:
" subscriberCount":" 42",来自thson json文档。
$.getJSON( "https://www.googleapis.com/youtube/v3/channels?part=statistics&id=UCgTe4gCl_pH-RNkgdcndl8g&key=AIzaSyARe-kxioXcvyS-WE3mx6Bo2fAijyG4OWo", function( data ) {
var items = [];
$.each( data, function( key, val ) {
items.push( "<li id='" + key + "'>" + val + "</li>" );
});
$( "<ul/>", {
"class": "my-new-list",
html: items.join( "" )
}).appendTo( "body" );
});
如何在文档中访问subscriberCount级别?
JSON数据如下所示:
{
"kind": "youtube#channelListResponse",
"etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/E7mYHJ0kZvDNIuPF1HnDg4A27lc\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/UFziElXqGi6jIN-zE5VbkSt4QvM\"",
"id": "UCgTe4gCl_pH-RNkgdcndl8g",
"statistics": {
"viewCount": "18242",
"commentCount": "1",
"subscriberCount": "42",
"hiddenSubscriberCount": false,
"videoCount": "104"
}
}
]
}