如何为嵌套 JSON 对象创建接口
How to create Interface for Nested JSON Object
我有一个嵌套的 JSON 对象,我需要创建接口并在我的 TS 文件中使用它...
{
"states":[
{
"location":"banglore",
"weather":{
"place":{
"heat":40,
"cold":60,
"place":"banglore"
}
}
},
]
}
试试这个
`export interface States{
"states":[
{
"location": string,
"weather":{
"place":{
"heat":number,
"cold":number,
"place":string
} }
}
]
}`
我有一个嵌套的 JSON 对象,我需要创建接口并在我的 TS 文件中使用它...
{
"states":[
{
"location":"banglore",
"weather":{
"place":{
"heat":40,
"cold":60,
"place":"banglore"
}
}
},
]
}
试试这个
`export interface States{
"states":[
{
"location": string,
"weather":{
"place":{
"heat":number,
"cold":number,
"place":string
} }
}
]
}`