Daniel Alvarez

How to display a dictionary in JSON format

swift

If you want to show a Swift dictionary in JSON format you can use the following line that shows it by console.

print(String(data: try! JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted), encoding: .utf8)!)