{
"Id": null,
"productType": {
"productname": "abc",
"productPrice": ""
}
}
如何将以上JSON转换为Product数组?
{
"Id": null,
"product": [{
"productType": {
"productname": "abc",
"productPrice": ""
}
}]
}
发布于 2018-08-22 03:52:24
这真的是一个TS问题吗?在这里,我不太确定到底在问什么。
但是,如果您所说的“如何转换”指的是TS类型:
原创
type ProductType = { productName: string, productPrice: string }
type Product = { id: string, productType: ProductType }
之后
type X = { id: string, product: ProductType[] }
https://stackoverflow.com/questions/51955718
复制相似问题