【发布时间】:2020-11-28 22:35:15
【问题描述】:
如何制作一个结构或类来快速解码以下类型的 json 结构?我想主要提取报表节点数据!
{
"earliest": "2020-10-17",
"latest": "2020-10-28",
"report": {
"purchase": {
"total": 1458600.0,
"average": 121550.0,
"min": 600000.0,
"max": 1600.0
},
"sale": {
"total": 434250.0,
"average": 144750.0,
"min": 360000.0,
"max": 29250.0
},
"production": {
"total": 792030,
"average": 20308.46153846154,
"min": 12000,
"max": 29700
}
}
}
【问题讨论】:
-
youtube上有很多这方面的教程,如果你google“Encode Decode JSON in swift”,你应该很容易找到答案
标签: json swift codable decodable encodable