I am having very basic question: but I am unable to find how to fetch a value from this
{
"content": {
"laptops": {
"brands": {
"company": "xyz",
"specification": {
"name": {
"description": "xyzName",
"type": "string"
},
"status": {
"description": "abcName",
"type": "string"
}
}
}
}
}
}
I want to fetch the brand value from the above response: ServiceClass:
getSample(): Promise<> {
return http
.get("http://localhost:8080/user")
.then((response) => {
console.log("sample",response);
return response.data;
})
.catch((error) => {
throw error;
});
}
}
useEffect:
useEffect(() => {
service
.getSample()
.then((data) => {
console.log("response", data);
})
.catch((err) => {
console.log(err);
});
}, []);
In console I am getting the complete response but I only want to fetch the "brands" Can any one help me with this!