Skip to content

Instantly share code, notes, and snippets.

@3lvis
Last active September 25, 2022 17:58
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
JSON Pretty Print Swift 5
print(String(data: try! JSONSerialization.data(withJSONObject: dict, options: .prettyPrinted), encoding: .utf8)!)
@gongzhang
Copy link

let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted

@3lvis
Copy link
Author

3lvis commented Sep 24, 2020

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment