How can I processing the json (https://engelhardt.ocloud.de/index.php/apps/phonetrack/api/getlastpositions/64dda53cc503629cedb5f8c8102708ed) to display the attributes (lat,lon, speed, ...) with vue / html ?
Json-content:
{
"64dda53cc503629cedb5f8c8102708ed": {
"Test": {
"lat": 50,
"lon": 10,
"timestamp": 15,
"batterylevel": 10,
"satellites": 5,
"accuracy": 10,
"altitude": 100,
"speed": 0,
"bearing": 0
}
}
}
Here is my index.html file to show the raw json content:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/vue.resource/1.0.3/vue-resource.min.js"></script>
</head>
<body>
<div id="vue-root">
Json-Raw: {{ jsonraw }}
</div>
</body>
<script>
new Vue({
el: "#vue-root",
data: {
jsonraw: [],
lat: [],
lon: []
},
created () {
this.fetchData()
},
methods: {
fetchData () {
fetch('https://engelhardt.ocloud.de/index.php/apps/phonetrack/api/getlastpositions/64dda53cc503629cedb5f8c8102708ed')
.then(response => {
this.jsonraw = response.data;
})
}
}
})
</script>
</html>
The browser result is empty:
Json-Raw: []
What is going wrong? How can I access to the single topics, like json.lat, json.lon or json.speed?