【发布时间】:2021-02-09 20:20:22
【问题描述】:
如何将此json文件中的数据转换为对象并显示在表格中
{
"AndraPradesh": {
"dData": {
"Anantapur": {
"notes": "",
"history":2
"delta": {
"force": 0
}
}
},
"sCode": "AP"
},
"Maharastra": {
"dData": {
"Pune": {
"notes": "",
"history":2
"delta": {
"force": 0
}
}
},
"sCode": "MH"
},
}
我创建了如下界面
export interface DataInterface {
sName: string[];
dName: dData[];
sdCode: string;
}
export interface dData{
name: string;
notes: string;
history: number;
delta: Delta[];
}
interface Delta {
force: number;
}
我还创建了一个类文件。我不确定是否可以将上述 json 转换为对象,以便将其分配给任何变量以进行进一步操作
【问题讨论】:
标签: json angular typescript