JSON
{
"callBackID" : "add1867f-6005-189c-bbb4-ff53202b0697",
"config" : {
"description" : "Welcome Page",
"show-bottom-bar" : "",
"css-page-align" : "",
"footer" : { "show" : "", "object" : "bottom-bar" },
"pageStyle" : "full-page",
"sourceType" : "list",
"title" : "Welcome Page",
"header" : { "show" : true, "hide" : false, "object" : "top-bar" },
"columns" : {},
"objects" : {},
"showtabs" : true,
"slides" : [{"title" : "first section","map" : ["open"]}],
"table" : "",
"show-top-bar" : true,
"style_max-width" : "",
"slideType" : "slide"
},
"method" : 106,
"parName" : "A1519614709427",
"formid" : "1"
}
模型
struct Params: Decodable {
let parName: String, method: Int, callBackID: String
let pageID: String?
let fields: [String: Properties]?, filter: [String: Properties]?, table: String?
let imageid: String?, imagetable: String?, appTemplate: String?, appName: String?, values: Properties?, columns: [String: Properties]?, formID: String?
let config: [String]? (sample only, this line is invalid.)
}
struct Properties: Decodable {
let source: String?, type: String?, rec_id: String?, name: String?, value: String?
}
你好!有了上面的数据,我的目标是打印“config”的值。我知道我可以通过创建更多结构来实现这一点,但这对很多人来说都是如此。也许有一个简单的方法。
打印(param.config!)
"description" : "Welcome Page", "show-bottom-bar" : "", "css-page-align" : "", "footer" : { "show" : "", "object" : "bottom-bar" }, "pageStyle" : "full-page", "sourceType" : "list", "title" : "Welcome Page", "header" : { "show" : true, "hide" : false, "object" : "top-bar" }, "columns" : {}, "objects" : {}, "showtabs" : true, "slides" : [{"title" : "first section","map" : ["open"]}], "table" : "", "show-top-bar" : true, "style_max-width" : "", "slideType" : "slide"
我怎样才能做到这一点^,感谢您的帮助:D