我正在对服务器进行铁 ajax 调用我将响应作为数组对象的数组作为 json
[{"dms":[{"serialNo":"EG0022","status":"running","firmwareStatus":"ok","latitude":37.8688,"longitude":-144.2093,"toolType":1},{"serialNo":"EG0022","status":"running","firmwareStatus":"ok","latitude":31.8688,"longitude":-115.2093,"toolType":1}],"gyro":[{"serialNo":"EG0022","status":"running","firmwareStatus":"ok","latitude":37.8688,"longitude":-144.2093,"toolType":1},{"serialNo":"EG0022","status":"running","firmwareStatus":"ok","latitude":31.8688,"longitude":-115.2093,"toolType":1}]}]
在我调用成功方法并打印我在控制台中获取的数据时的成功响应中,我应该如何在成功方法中解析这个对象数组的对象?
<!-- import polymer -->
<script src="../../bower_components/webcomponentsjs/webcomponentslite.js"></script>
<link rel="import" href="../../bower_components/polymer/polymer.html"/>
<link rel="import" href="../../bower_components/paper-item/paperitem.html">
<link rel="import" href="../../bower_components/paper-listbox/paperlistbox.html">
<link rel="import" href="../../bower_components/paper-dropdown-menu/paperdropdown-menu.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<!-- seed app components -->
<dom-module id="tool-bar">
<template>
<iron-ajax
id="ajax"
url=" rest URL"
params='{"type":"all"}'
handle-as="json"
content-type="application/json"
method="GET"
on-response="mapResponse"
debounce-duration="3000">
</iron-ajax>
</template>
<script>
Polymer({
is : 'tool-bar',
properties: {
gyrodata: {
type: Array
}
},
mapResponse: function (data) {
console.log(data.detail.response); //[Object,Object]
}
});
</script>
</dom-module>