json - 如何在数据服务中保存来自 httpclient 的数据以及如何循环通过我的 json 对象
问题描述
我有一个生成的 json 对象槽
$json_str = file_get_contents('php://input'); echo json_encode($json_str);
看起来像:
0:[{"dok_1": "78",
"dok_45": "556",
"dok_e": "cde",
"dok_cd": "678",
"dok_bv": "5z",
"dok56": "rtz",
"dok_z6": "abc",
"dok_u8": "123"}]
我正在使用 Angular App Http Service 导入数据
onGetData() {return this.httpCient.get('https://www.mywebpage.com/...');}
users;
onGet() {this.httpService.onGetData().subscribe(data => this.users = data);}
效果很好。
如何将上述 json 对象存储在我的 http 服务或数据服务中?
有没有类似的东西
addData(users: object) {
this.users.push(data);
}
保存数据和
getData() {
return this.users;
}
取回数据?或者如何将 json 对象保存在 http 服务或数据服务中?我需要额外的数据服务还是 http 服务适合保存这个 json 对象?
以及如何循环通过 json 对象?
有没有类似的东西
<li *ngFor="let user of users">{{user}}</li>
? 但是我怎样才能访问键值以循环遍历每一行呢?
解决方案
推荐阅读
- java - RxJava 与 JavaFx 的性能差
- javascript - 传单路由机器值未显示
- r - 数据表的set函数中的ifelse条件
- macos - 通过 IntelliJ 运行 maven 任务:Maven 资源插件权限被拒绝
- python - 避免 Numba CUDA Jit 竞争条件
- lua - Pandoc lua 过滤器强制压缩列表
- javascript - 如何使用 applescript 和 shell 解压缩文件,但不会收到以下错误?
- xml - 设计问题 - 是否有可能设计一个足以处理对象列表的通用 XML
- javascript - 最新版本的 Chrome 加载 xml 文件的奇怪问题
- amazon-web-services - 为 Lambda 函数保存和检索数据的最佳方式是什么?