2014-02-25 51 views
1

我试图扁平和JSON组合价值扁平JSON文件,这里的JSON使用JavaScript /咖啡d3.json

https://api.github.com/repos/wesm/D3py/commits

我已经成功地通过每个位置提取使用下面

这种咖啡的代码
d3.json "https://api.github.com/repos/wesm/D3py/commits", (data) -> 
    console.log data[0].commit.author.name 
    return 

但是当我试图做类似的东西在这里下面我期望看到的名字排列,但一无所获,

d3.json "https://api.github.com/repos/wesm/D3py/commits", (data) -> 
    names = (name for name in data.commit.author.name) 
    console.log names 
    return 

回答

1
names = (entry.commit.author.name for entry in data) 
+0

谢谢! @meetamit这个伟大的作品,它花了我3个小时! – JPC