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

4
6

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

4 (6 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
swift map json to dictionary string any swift convert dictionary to json string swift create json from dictionary swift parse json into dictionary dictionary to json string swift 4 dictionary to json swift 4 swiftui convert json to dictionary how to convert jsonValue to dictionary in swift how to convert json data to dictionary in swift dict to json swift swift json dict swift 5 convert dictionary to json string swift how parse json with dictionary convert dictionary to json in swift how to convert dictionary into json in swift swift dictionary array to json swift dictionary any to json swift dictionary to json string online json data to dictionary swift convert array of dictionary to json swift swift string to json dic dictionary string any to json swift 5 how to convert dictionary to json in swift 5 swiftyjson json to dictionary json dictionary swift swift dictionary to json swiftyjson print the dictionary as json dictionary in swift 5 json dictionary to json object swift 5 function json dictionary to json swift 5 json dictionary to json swift 5 convert json string to dictionary in swift 5 convert json array to dictionary in swift 5 convert json to dictionary in swift dictionary to json swift dictionary to json ios swift json string to dictionary swift swift json string to dictionary json object to array of dictionary swift ios casting json to dictionary swiftyjson swift casting json to dictionary swift converting json to dictionary swiftyjson swift converting json to dictionary swift convert array of dictionary to json string swift swift json to dictionary swift read dictionary from json swift string json to dictionary serialise json dictionary ios swift convert dictionary to json dictionary in swift convert json to dictionary swift 5 json to swift dictionary converter convert json to dictionary swift json to dictionary swift convert dictionary to json object swift swift dictionary to json object swift dictionary to string json How to create dictionary using json in swift dictionary to json in swift dictionary to json object swift swift string to json dictionary print dictionary to json swift swift dictionary to json string swift object to dictionary convert dictionary to an object swift dictionary ot json string in swift 5 array dictionary to json string in swift 5 Swift convert String Any to JSON how to array of dictnary data convert to json encode in swift howo to turn a dictionary in swift to jsoon dictionary to json string swift convert dict to data swift dic to data swift convert swift dictionary to json dic to JsonObjec in swift dic to json in swift how to Dictionary to json in swift swift 5 convert dictionary to json ios how to conver Dictionry to JSON formate in sswift convert dictionary to data swift can u JSONSerialize a swift dictionary Data to dictionary swift 5 swift convert dictionary to data swift json from dictionary how to sereilaze a key and value type of dictionay into json format in swift swift convert to json swift dictionary to json convert dict to json swift convert dictionary to json string swift convert dictionary to json swift dictionary json swift convert dictionary to json c# dart json decode list how to add data to dictionary swift ios swift dictionary to json string convert dictionary to json serialization swift 4 convert dictionary into json swift swift convert dictionary to json
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source