我正在使用SwiftyJson,并在下面编写了代码,
for (_, value) in json["assets"] {
print(value)
}
我在控制台中得到了这个结果:
[
{
"urlImage" : "https:myFirstUrl",
"page" : 1
},
{
"urlImage" : "https:mySecondUrl",
"page" : 2
}]
但是现在我想检索“ urlImage”以在常量中分配此值。
答案 0 :(得分:2)
您可以尝试以下方法:
result.component.ts
@Component({
providers: [HintService],
selector: 'app-result',
styleUrls: [
'result.component.scss',
'../../../../../node_modules/@swimlane/ngx-datatable/release/index.css',
'../../../../../node_modules/@swimlane/ngx-datatable/release/themes/material.css',
'../../../../../node_modules/@swimlane/ngx-datatable/release/themes/bootstrap.css',
'../../../../../node_modules/@swimlane/ngx-datatable/release/assets/icons.css'
],
templateUrl: 'result.component.html'
})
我希望它会有所帮助。