以前我使用的json文件格式如下:
[{"lat":43.788458853157117,"lng":-79.282781549043008,"category":"volunteer","name":"Rita","url":"", "description":"xxx is a member of 13"},{"lat":43.7,"lng":-79.4,"category":"organization","name":"TCAN","url":"http://tcan.ca","description":"Lorem ipsum"}]
现在我正在尝试从Drupal站点生成json文件,并获得以下结构。如何引用最低级别的字段。我查看了使用d3.net的示例,但没有找到任何适用的示例。
{
"organizations": [
{
"member": {
"field_category": "organization",
"body": "A network of organizations in Toronto devoted to climate change mitigation and adaptation.",
"URL": "xxx.ca",
"title": "Toronto Climate Action Network",
"field_lat": 43.7,
"field_long": -79.4
}
},
{
"member": {
"field_category": "abc",
"body": "xxx.",
"URL": "",
"title": "yyy",
"field_lat": 43.7,
"field_long": -79.28
}
}
]
}
答案 0 :(得分:1)
假设您的数据存储在变量data
中:
var bottom = data.organizations.map(function(d) { return d.member; });