How do you access json in JavaScript?
In below image is the JSON that I've successfully send and I need it to retrieve in my client side.
But when I print it in my console it looks like this. Do you guys have any idea what happened in here?
I tried it accessing by something like this in my Vue:
<b-button @click="getDisease()">Search Disease</b-button>
<b-form-input v-model="search"></b-form-input>
<p>{{results}}</p>
import axios from "axios";
export default {
data() {
return {
search: "",
results: {}
};
},
getDisease() {
axios
.get("http://localhost:9000/api/disease/" + this.search)
.then(response => (this.results = response.data))
.catch(error => alert(error));
console.log(this.results);
let myJson = JSON.stringify(this.results);
console.log(myJson[0].ICD_C);
},