Is there any publicly accessible JSON data source to test with real world data?

我正在开发一个 JavaScript 动态加载的树视图用户控件。

Does anybody know any public service with an API that provides access to hierarchical data in JSON format?

154753 次浏览

Twitter 有一个返回 JSON 的公共 API ,例如-

GET请求:

https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=mralexgray&count=1,

EDIT: Removed due to twitter restricting their API with OAUTH requirements...

{"errors": [{"message": "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68}]}

用一个简单的 Github API示例替换它-返回一个树,在本例中是我的存储库..。

Https://api.github.com/users/mralexgray/repos

我不会包括输出,因为它很长。.(每次返回30个回购协议) ... ... 但这里有证据证明它是树形的。

enter image description here

Tumblr 有一个提供 JSON 的 public API。您可以使用像 http://puppygifs.tumblr.com/api/read/json这样的简单 URL 获得一个文章转储。

Tumbler V2 API提供了一个纯 JSON 响应,但是需要跳过几个环:

  1. 注册申请
  2. Get your "OAuth Consumer Key" which you'll find when editing your application from 应用程序页面
  3. 使用任何只需要 API 密钥的 方法来进行身份验证,因为这可以在 URL 中传递,例如 职位
  4. 享受您的 JSON 响应吧!

Example URL: http://api.tumblr.com/v2/blog/puppygifs.tumblr.com/posts/photo?api_key=YOUR_KEY_HERE

结果显示 小提琴手的树木结构:

Screenshot

我在 Flickr 上找到一个不需要注册的。

基本样本,小提琴 更多信息: < a href = “ http://richardShepherd. com/how-to-use-jquery-with-a-json-flickr-feed-to-display-photos/”rel = “ nofollow noReferrer”> post

// Querystring, "tags" search term, comma delimited
const query = "https://www.flickr.com/services/feeds/photos_public.gne?tags=soccer&format=json&jsoncallback=?";




// This function is called once the call is satisfied
// http://stackoverflow.com/questions/13854250/understanding-cross-domain-xhr-and-xml-data
let mycallback = function(data) {
// Start putting together the HTML string
let htmlString = "";


// Now start cycling through our array of Flickr photo details
$.each(data.items, function(i, item) {
// I only want the ickle square thumbnails
let sourceSquare = (item.media.m).replace("_m.jpg", "_s.jpg");


// Here's where we piece together the HTML
htmlString += '<li><a href="' + item.link + '" target="_blank">';
htmlString += '<img title="' + item.title + '" src="' + sourceSquare;
htmlString += '" alt="';
htmlString += item.title + '" />';
htmlString += '</a></li>';


});


// Pop our HTML in the #images DIV
$('#images').html(htmlString);
};




// Ajax call to retrieve data
$.getJSON(query, mycallback);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="images"></div>

Another very interesting is 星球大战休息应用程序接口

JSON 测试有一些

尝试它的免费和其他功能也。

http://www.jsontest.com/