swift convert dictionary to json
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)
}
}
Also in Swift:
- number of characters in a string swift
- dark mode change immediately swift
- replace character in swift
- swift allow gesture recognizer over others
- chating App in swift
- swift enum
- how to select but not focus textfield swift
- loop key value swift
- swift close app
- how to make a image flip swift
- blur background swiftui
- create dictionary swift
- swift create uinavigationcontroller programmatically
- swift save data to file
- how to make box shadow swift
- remove all add TapGestureRecognizer swift
- how to screen record swift stackoverflow
- navigationviewcontroller setviewcontrollers swift
- how to set the center in view in swift
- swift xcode debug cannot see code backtrace
- how to change background color swift
- swift convert dictionary to json
- swift bring something to front of view
- How to set back button text in Swift