是否有任何可公开访问的JSON数据源来测试真实世界的数据?

ILy*_*Lya 106 javascript testing treeview json

我正在开发一个JavaScript动态加载的树视图用户控件.我想用真实世界的数据进行测试.

有没有人知道任何提供JSON格式的分层数据访问API的公共服务?

Ale*_*ray 61

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

一个GET请求:

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

编辑: 由于Twitter限制他们的API有OAUTH要求删除...

{"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}]}
Run Code Online (Sandbox Code Playgroud)

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

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

我不会包含输出,因为它很长..(一次返回30个回购)...但这里证明它是树形的.

在此输入图像描述

  • 嗯,我认为它是...... [看起来像一棵树](http://f.cl.ly/items/3v0v0Q0B2W233g371w15/Google%20Chrome.png),像树一样呱呱叫,像http上的树一样工作: //jsontree.com/.一定是树,不是吗? (5认同)
  • 现在这不公开... :( (5认同)
  • @shabunc它被称为[Cocoa JSON Editor](http://www.cocoajsoneditor.com). (3认同)

小智 31

JSON测试有一些

尝试免费并具有其他功能.

http://www.jsontest.com/

  • 从主机获取"超额配额"错误.猜猜大家都知道了. (22认同)
  • 是2016年,现在还没有HTTPS支持,到底是什么? (3认同)

Cod*_*rer 11

Tumblr有一个提供JSON 的公共API.您可以使用简单的URL来获取帖子转储http://puppygifs.tumblr.com/api/read/json.


Bra*_*lio 10

从Flickr找到一个不需要注册/ api的.

基本样本,小提琴:http://jsfiddle.net/Braulio/vDr36/

更多信息:发布

粘贴样品

HTML

<div id="images">

</div>
Run Code Online (Sandbox Code Playgroud)

使用Javascript

// Querystring, "tags" search term, comma delimited
var query = "http://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
var mycallback = function (data) {

    // Start putting together the HTML string
    var htmlString = "";

    // Now start cycling through our array of Flickr photo details
    $.each(data.items, function(i,item){

        // I only want the ickle square thumbnails
        var 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);
Run Code Online (Sandbox Code Playgroud)

另一个非常有趣的是星球大战休息API:

https://swapi.co/