Can anyone help me with accessing JSON data in the DOM using Vue.js?
Here is my script tag:
<script>
import axios from "axios";
export default {
components: {},
data() {
return {
responseObject: ""
};
},
async mounted() {
try {
const response = await axios.get("http://localhost:4000/api/blogs");
console.log(response);
} catch (e) {
}
}
};
</script>
My template to display the data is not showing anything:
<div>
{{responseObject}}
</div>
This is the JSON data I want to display:
{
"status": true,
"responseObject": {
"resource": "services",
"status": "success",
"data": [
{
"service_id": "0001",
"service_name": "Buy Airtime",
"service_type": "airtime"
},
]}}
Could someone please guide me on how to display this JSON data in the DOM?