javascript - 如何从 json.stringify 中读取特定值:离子
问题描述
从帖子中我得到了一个资源
.subscribe( res => {
let result = JSON.stringify(res);
alert(result)
})
& 作为alert(result)
我得到的回应
{"access_token": "hjhdshJHUHYI67HUjhhk98BJ_BJHBBHbnbhbhbjh_jmnhghmghgfffgxcgfcf98hujh",
"expires_in":"518399"}
在这里,我想读取access_token
值并将其保存在变量中我该怎么做?
解决方案
您不必进行字符串化,只需将其作为res.access_token
.subscribe((res:any) => {
let result = res.access_token;
alert(result)
})
推荐阅读
- wordpress - 如何更改 woocommerce 产品页面上的文本
- python - 如何使用 OOP 类继承 tkinter GUI 窗口?
- docker - curl docker 在本地机器上工作,但不在服务器上
- angular - Angular-不能使用命名空间'moment'作为类型
- android - 运行时用 appcompat 覆盖 android
- javascript - 滚动经过片段时,Angular 10会获得路由器活动片段吗?
- c# - 转换为泛型
- c++ - C++ Eigen LU 分解 - 行列式的符号
- soap - 使用 Dell Boomi 将 SOAP GET 请求检索到的数据存储在数据库中
- javascript - 当我将鼠标悬停在另一行上时,如何在表格中隐藏引导下拉菜单?