我有一个JSON文档看起来像这样:数日间功能的JavaScript
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"time": 1438342780,
"title": "Iran's foreign minister calls for world's nuclear weapons states to disarm",
"author": "Julian Borger",
"web_id": "world/2015/jul/31/iran-nuclear-weapons-states-disarm-israel"
},
"geometry": {
"type": "Point",
"coordinates": [
-77.26526,
38.90122
]
}
},
{
"type": "Feature",
"properties": {
"time": 1438300867,
"title": "Big bangs over the white cliffs of Dover as unique 1915 artillery gun is fired again",
"author": "Maev Kennedy",
"web_id": "world/2015/jul/31/big-bangs-over-white-cliffs-dover-unique-1915-artillery-gun-fired-again"
},
"geometry": {
"type": "Point",
"coordinates": [
1.3,
51.13333
]
}
}
]
}
我想取里面的JSON“功能”数组并返回了许多功能对于一个给定的一天。例如,对于上述数据我希望是这样的:
{
"date": 7/31/2015,
"number": 2
}
目前,我有一些看起来像这样:
d3.json('path/to/json', function(json) {
data = json;
});
相当新的JS和D3所以有点难倒。让我知道你是否需要更多细节。提前致谢!
这是您的日期字段? ''时间“:1438342780' –
我认为日期来自'web_id'。 – Andy
是的,对不起,日期与'时间'键相关并且处于时代格式。 – sammy88888888