Swift Dictionary To Json String Online

[Solved] Swift Dictionary To Json String Online | Swift - Code Explorer | yomemimo.com
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

Answers related to swift dictionary to json string online

Code Explorer Popular Question For Swift