Question : swift convert dictionary to json
Answered by : mobile-star
let dic = ["2": "B", "1": "A", "3": "C"]
let encoder = JSONEncoder()
if let jsonData = try? encoder.encode(dic) { if let jsonString = String(data: jsonData, encoding: .utf8) { print(jsonString) }
}
Source : | Last Update : Wed, 05 Feb 20
Question : convert dictionary to json serialization swift 4
Answered by : calm-crossbill-dm70111ivgoa
["A":123, "B":455]
Source : | Last Update : Mon, 25 May 20