Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

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)
    }
}
Comment

convert dictionary to json serialization swift 4

["A":123, "B":455]
Comment

PREVIOUS NEXT
Code Example
Swift :: xcode get info from text field 
Swift :: find object in array by property swift 
Swift :: swift set view z order front 
Swift :: swift get app version and build 
Swift :: playing a sound in swift 
Swift :: custom screen presentation controller coner radius swift 
Swift :: increase the size of the image in Swiftui 
Swift :: swift get current time 
Swift :: swift 5 func to increase number every time call 
Swift :: swiftui navigationview ignore top space 
Swift :: swiftui button transparent background 
Swift :: swift access appdelegate from viewcontroller 
Swift :: swift constraint center vertically 
Swift :: swift rounded tab bar 
Swift :: replace character in swift 
Swift :: index string swift 
Swift :: swiftui scrollview 
Swift :: set button programmatically swift 
Swift :: swiftui 100 days 
Swift :: switch case in swift language 
Swift :: wkwebview load delegate in swift 
Swift :: swift scrollview auto fit content height 
Swift :: swiftui crop image 
Swift :: Swift Trailing Closure 
Swift :: did select row at 
Swift :: swift create custom button with icon programmatically 
Swift :: Swift Access Array Elements 
Swift :: move view controller to make space for keyboard swift 5 
Swift :: while loops swift 
Swift :: Swift Iterate Over a Set 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =