【发布时间】:2017-01-18 07:59:14
【问题描述】:
我有以下问题,我现在尝试了 3 天都无法解决。我有一个 JSON 数组:
var geojson = {
type: 'FeatureCollection',
features: [
{
"type": "Feature",
"geometry": {
"coordinates": [
5.140439,
51.686608
],
"type": "Point"
},
"properties": {
"title": "TEST1",
"rentals": true,
"tackleshop": false,
"fuel": false,
"marker-color": "#1087bf",
"marker-size": "large",
"marker-symbol": "harbor"
}
},
{
"type": "Feature",
"geometry": {
"coordinates": [
5.134060,
51.686890
],
"type": "Point"
},
"properties": {
"title": "TEST2",
"rentals": true,
"tackleshop": false,
"fuel": true,
"marker-color": "#1087bf",
"marker-size": "large",
"marker-symbol": "harbor"
}
},
{
"type": "Feature",
"geometry": {
"coordinates": [
5.133729,
51.681425
],
"type": "Point"
},
"properties": {
"title": "TEST3",
"rentals": false,
"tackleshop": true,
"fuel": true,
"marker-color": "#1087bf",
"marker-size": "large",
"marker-symbol": "harbor"
}
}
]
};
我现在测试的内容:
$.each(geojson, function() {
$.each(this, function(key, value) {
$.each(this, function(value, featuress) {
console.log(featuress.properties.title);
});
});
});
我想要的结果: 我想要一个通过这个 json 数组的 $.each,我可以在其中显示变量,例如:每个功能的“标题”。
谁能帮帮我?干杯!
【问题讨论】:
标签: json multidimensional-array