我有一个非常基本的问题:但是我找不到如何从中获取值
{
"content": {
"laptops": {
"brands": {
"company": "xyz",
"specification": {
"name": {
"description": "xyzName",
"type": "string"
},
"status": {
"description": "abcName",
"type": "string"
}
}
}
}
}
}
我想从上述回复中获取品牌价值: 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);
});
}, []);
在控制台中,我得到了完整的答复,但我只想获取“品牌” 。任何人都可以帮我解决这个问题!